import 'package:dio/dio.dart'; import 'package:lszlgl/config/app_config.dart'; import 'api.dart'; class MyApi { MyApi._(); /// 生产url static String productUrl = 'http://121.36.17.6:49099'; /// 测试url static String testUrl = 'http://121.36.17.6:19090'; static late String globalUrl; static void init(AppEnvironment env) { globalUrl = switch (env) { AppEnvironment.develop => testUrl, AppEnvironment.product => productUrl, }; } static Api get({Dio? dio, String? baseUrl}) { return Api( dio: dio, baseUrl: baseUrl ?? globalUrl, ); } }