import 'dart:async'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:get/get_connect/http/src/request/request.dart'; import 'package:sp_util/sp_util.dart'; import 'package:dreampad/app/shared/constants/constants.dart'; FutureOr requestInterceptor(request) async { final token = SpUtil.getString(Constant.accessToken); if (token!.isNotEmpty) { request.headers['Authorization'] = 'Bearer $token'; } if (!SmartDialog.config .checkExist(dialogTypes: {SmartAllDialogType.loading})) { SmartDialog.showLoading(msg: '正在努力加载中…'); } return request; }