bytedance / flutter_ume

UME is an in-app debug kits platform for Flutter. Produced by Flutter Infra team of ByteDance
MIT License
2.07k stars 224 forks source link

[DioInspector]: flutter_ume_kit_dio always shows “Come back later ...” #118

Open ruoduan-hub opened 1 year ago

ruoduan-hub commented 1 year ago

flutter_ume_kit_dio always shows “Come back later ...”

import 'package:basecommonlib/basecommonlib.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

import 'app.dart';
import 'application.dart';

import 'package:dio/dio.dart';

import 'package:flutter_ume/flutter_ume.dart'; // UME 框架
import 'package:flutter_ume_kit_ui/flutter_ume_kit_ui.dart'; // UI 插件包
import 'package:flutter_ume_kit_perf/flutter_ume_kit_perf.dart'; // 性能插件包
import 'package:flutter_ume_kit_show_code/flutter_ume_kit_show_code.dart'; // 代码查看插件包
import 'package:flutter_ume_kit_device/flutter_ume_kit_device.dart'; // 设备信息插件包
import 'package:flutter_ume_kit_console/flutter_ume_kit_console.dart'; // debugPrint 插件包
import 'package:flutter_ume_kit_dio/flutter_ume_kit_dio.dart'; // Dio 网络请求调试工具

final Dio dio = Dio()
  ..options = BaseOptions(
    baseUrl: Network.BASE_URL,
    connectTimeout: Network.CONNECT_TIMEOUT,
    receiveTimeout: Network.RECEIVE_TIMEOUT,
    contentType: Network.ContentTypeJson,
  );

void main() => Application.init(() {
      EnvironmentType envType = Network.CURRENT_ENVIRONMENT;
      if (envType == EnvironmentType.test) {
        PluginManager.instance // 注册插件
          ..register(WidgetInfoInspector())
          ..register(WidgetDetailInspector())
          ..register(ColorSucker())
          ..register(AlignRuler())
          ..register(ColorPicker()) // 新插件
          ..register(TouchIndicator()) // 新插件
          ..register(Performance())
          ..register(ShowCode())
          ..register(MemoryInfoPage())
          ..register(CpuInfoPage())
          ..register(DeviceInfoPanel())
          ..register(Console())
          ..register(DioInspector(dio: dio)); // 传入你的 Dio 实例
        // flutter_ume 0.3.0 版本之后
        return runApp(UMEWidget(child: MyApp(), enable: true)); // 初始化
      } else {
        return runApp(MyApp());
      }
    });
ruoduan-hub commented 1 year ago

PS:

mdddj commented 1 year ago
flutter_ume_kit_dio_plus: ^2.0.0