Blame view

lib/common/request/request.dart 365 Bytes
056970d8   Key   feat: api
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  import '../../utils/loading.dart';
  import 'exception.dart';
  import 'exception_handler.dart';
  
  Future request(
    Function() block, {
    bool showLoading = true,
    bool Function(ApiException)? onError,
  }) async {
    try {
      await loading(block, isShowLoading: showLoading);
    } catch (e) {
      handleException(ApiException.from(e), onError: onError);
    }
    return;
  }