fl_dio 0.2.1 copy "fl_dio: ^0.2.1" to clipboard
fl_dio: ^0.2.1 copied to clipboard

Extended dio and added three interceptors and the JsonParse component.

fl_dio #

Extended dio and added three interceptors and the JsonParse component. #

Example web #

void main() {
  GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();

  /// 必须设置 DebuggerInterceptorHelper
  /// You must set up DebuggerInterceptorHelper
  DebuggerInterceptorHelper().navigatorKey = navigatorKey;

  /// 设置JsonParse字体颜色
  /// Set the JsonParse font color
  JsonParse.color = JsonParseColor();

  /// ExtendedDio 添加全局拦截
  /// Add an interceptor for ExtendedDio
  /// 
  ExtendedDio().initialize(interceptors: [

    /// 日志打印
    LoggerInterceptor(),

    /// debug 调试工具
    DebuggerInterceptor(),

    /// cookie 保存和获取
    CookiesInterceptor()
  ]);

  ///  你也可以使用自己的dio,并添加拦截器,拦截器是独立存在的
  ///  You can also use your own dio and add interceptors, which stand alone
  List<Interceptor>list = [

    /// 日志打印
    LoggerInterceptor(),

    /// debug 调试工具
    DebuggerInterceptor(),

    /// cookie 保存和获取
    CookiesInterceptor(),
  ];
  runApp(MaterialApp(
    navigatorKey: navigatorKey,
    debugShowCheckedModeBanner: false,
    theme: ThemeData.light(useMaterial3: true),
    darkTheme: ThemeData.dark(useMaterial3: true),
    home: const Scaffold(body: HomePage()),
  ));
}

3
likes
160
points
135
downloads

Publisher

unverified uploader

Weekly Downloads

Extended dio and added three interceptors and the JsonParse component.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

dio, flutter, http_parser

More

Packages that depend on fl_dio