my_api.dart 708 B

12345678910111213141516171819202122232425262728293031323334
  1. import 'package:dio/dio.dart';
  2. import 'package:lszlgl/config/app_config.dart';
  3. import 'api.dart';
  4. class MyApi {
  5. MyApi._();
  6. /// 华为 生产url
  7. //static String productUrl = 'http://121.36.17.6:39099';
  8. /// 紫光 生产正式 url
  9. static String productUrl = 'http://101.36.160.117:39099';
  10. /// 测试url
  11. static String testUrl = 'http://101.36.160.117:31070';
  12. static late String globalUrl;
  13. static void init(AppEnvironment env) {
  14. globalUrl = switch (env) {
  15. AppEnvironment.develop => testUrl,
  16. AppEnvironment.product => productUrl,
  17. };
  18. }
  19. static Api get({Dio? dio, String? baseUrl}) {
  20. return Api(
  21. dio: dio,
  22. baseUrl: baseUrl ?? globalUrl,
  23. );
  24. }
  25. }