dreampad/lib/app/api/base_provider.dart

17 lines
552 B
Dart
Raw Permalink Normal View History

2023-11-28 10:44:58 +08:00
import 'package:get/get.dart';
import 'api_constants.dart';
import 'interceptors/adapter_interceptor.dart';
import 'interceptors/request_interceptor.dart';
import 'interceptors/response_interceptor.dart';
class BaseProvider extends GetConnect {
@override
void onInit() {
httpClient.baseUrl = ApiConstants.baseUrl;
httpClient.timeout = const Duration(seconds: 180);
httpClient.addRequestModifier(requestInterceptor);
httpClient.addResponseModifier(responseInterceptor);
httpClient.addResponseModifier(adapterInterceptor);
}
}