my_api.dart 433 B

12345678910111213141516171819202122
  1. import 'package:dio/dio.dart';
  2. import 'package:flutter/foundation.dart';
  3. import 'api.dart';
  4. class MyApi {
  5. MyApi._();
  6. static String productUrl = 'http://121.36.17.6:49099';
  7. static String testUrl = 'http://121.36.17.6:19090';
  8. static Api get({Dio? dio, String? baseUrl}) {
  9. if (kReleaseMode) {
  10. baseUrl ??= productUrl;
  11. } else {
  12. baseUrl ??= testUrl;
  13. }
  14. return Api(dio: dio, baseUrl: baseUrl);
  15. }
  16. }