1

AnyInspect v0.1.0 - 一个使用 Flutter Desktop 开发,用于调试 Flutter 应用的工具

 2 years ago
source link: https://segmentfault.com/a/1190000040946969
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

AnyInspect 是什么?

AnyInspect 是一个用于调试您的 Flutter 应用的工具,使用 Dart / Flatter 编写。当前你可以使用 AnyInspect 来检查应用中的传出网络请求或查看 SharedPreferences 数据,未来你甚至可以在 AnyInspect 查看修改应用数据库的数据。

可在 发布 页面下载 AnyInspect 桌面端。 另请查看 网站 以了解其他安装方法。

下载安装 AnyInspect 桌面端后,将 anyinspect 与配套插件集成到你的项目后重新运行你的应用。

你也可以直接安装集成示例来查看效果:anyinspect_integrate_example

将此添加到项目的 pubspec.yaml 文件:

dependencies:
  anyinspect: ^0.1.0
  # 已支持的插件,请根据你的需求进行添加。
  anyinspect_plugin_network: ^0.1.0
  anyinspect_plugin_shared_preferences: ^0.1.0
import 'package:anyinspect/anyinspect.dart';
import 'package:anyinspect_plugin_network/anyinspect_plugin_network.dart';
import 'package:anyinspect_plugin_shared_preferences/anyinspect_plugin_shared_preferences.dart';

Future<void> main(List<String> args) async {
  AnyInspect anyInspect = AnyInspect.instance;
  anyInspect.addPlugin(AnyInspectPluginNetwork());
  anyInspect.addPlugin(AnyInspectPluginSharedPreferences());
  anyInspect.start();
  
  // ...
}

显示辅助球

辅助球可以显示与桌面端的连接状态,并可以在断开连接后进行手动重连。

import 'package:anyinspect/anyinspect.dart';
import 'package:flutter/material.dart';

class HomePage extends StatefulWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  void initState() {
    super.initState();
    // 在您的首页显示辅助球。
    AnyInspect.instance.assistiveBall.show(context);
  }

  @override
  Widget build(BuildContext context) {
    // ...
  }
}

这些是可用的插件。

欢迎加入讨论组与我分享你的建议和想法。

  • 微信讨论组,请添加我的微信 lijy91,并备注 AnyInspect
  • QQ 讨论组

Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK