|
@@ -19,7 +19,7 @@ import 'package:shared/utils/log_utils.dart';
|
|
*/
|
|
*/
|
|
class GlobalServicesInjection {
|
|
class GlobalServicesInjection {
|
|
/// init
|
|
/// init
|
|
- static Future init({void Function()? additionalDependencies}) async {
|
|
|
|
|
|
+ static void init({void Function()? additionalDependencies}) {
|
|
Log.d('----ConfigServicesInjection------start-----');
|
|
Log.d('----ConfigServicesInjection------start-----');
|
|
|
|
|
|
//全局单例的 HttpProvider 用于发起网络请求
|
|
//全局单例的 HttpProvider 用于发起网络请求
|
|
@@ -47,4 +47,14 @@ class GlobalServicesInjection {
|
|
|
|
|
|
Log.d('----ConfigServicesInjection------end-----');
|
|
Log.d('----ConfigServicesInjection------end-----');
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // 切换应用的BaseUrl的逻辑
|
|
|
|
+ static void switchBaseUrl(String baseUrl) {
|
|
|
|
+ Get.replace(
|
|
|
|
+ HttpProvider(
|
|
|
|
+ baseUrl, // 使用新的 baseUrl
|
|
|
|
+ interceptors: [StatusCodeDioInterceptors(), AuthDioInterceptors()],
|
|
|
|
+ ),
|
|
|
|
+ );
|
|
|
|
+ }
|
|
}
|
|
}
|