具有基本实现的应用程序将能够访问此库发出的网络请求的仪表板。

ttt

特点

仪表板已打开

实现完成后,您只需调用带有检查器实例的 open 函数即可。

    InspectorManager.open();

通过摇动打开仪表板

您也可以通过摇动来打开仪表板。

   NetworkDetailView(
      isEnableShake: true,
      child: MaterialApp(
        ..
      ),);

入门

在您使用的包中实现这些步骤非常简单。基本上,它会监视您的网络请求。

在使用此包之前,您必须安装 Vexana

用法

添加代表您根视图或您想监听的内容的小部件。之后,创建一个带有导航观察属性的 material widget。

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return NetworkDetailView(
      isEnableShake: true,
      child: MaterialApp(
        navigatorObservers: [InspectorManager.navigatorObserver],
        title: 'Material App',
        home: const JsonPlaceHolder(),
      ),
    );
  }
}

此代码可以在任何地方 [InspectorManager.open();] 打开仪表板,例如,双击或向右滑动。

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onHorizontalDragEnd: (DragEndDetails details) {
        final velocity = details.primaryVelocity ?? 0;
        if (velocity > 0) {
          // User swiped Left
        } else if (velocity < 0) {
          // User swiped Right
          InspectorManager.open();
        }
      },
      onTertiaryTapUp: (tapDetails) {
        InspectorManager.open();
      },
      child: Scaffold(
        floatingActionButton: FloatingActionButton(
          onPressed: () {
            getAllPosts();
            // InspectorManager.open();
          },
        ),
        appBar: buildAppBar(),
        body: buildListView(),
      ),
    );
  }

附加信息

请将您的想法添加到 issue 或 PR 评论中,我会尽快合并。

GitHub

查看 Github