flutter_ume停更了,那我就自己写一个flutter_mana

flutter_mana 是一个 Flutter 应用内调试平台,它提供了统一的调试入口和面板,内置了多个实用调试插件,同时支持开发者注册自定义插件。

因为flutter_ume不维护,项目因此而生,mana的名字来自于一部国漫《灵笼》中的玛娜设定,强烈推荐!

安装

shell 复制代码
# 安装核心
flutter pub add flutter_mana
# 安装插件
flutter pub add flutter_mana_kits

使用

dart 复制代码
import 'package:flutter/material.dart';
import 'package:flutter_mana/flutter_mana.dart';
import 'package:flutter_mana_kits/flutter_mana_kits.dart';


void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // 注册插件
  ManaPluginManager.instance
    ..register(ManaPackageInfo())
    ..register(ManaMemoryInfo())
    ..register(ManaShowCode())
    ..register(ManaLogViewer())
    ..register(ManaDeviceInfo())
    ..register(ManaColorSucker())
    ..register(ManaDioInspector())
    ..register(ManaWidgetInfoInspector())
    ..register(ManaFpsMonitor())
    ..register(ManaSharedPreferencesViewer())
    ..register(ManaAlignRuler());

  // 包裹
  runApp(ManaWidget(child: MyApp()));
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Example',
      home: Text('Example'),
    );
  }
}

尽量在开发环境使用,部分插件只在开发环境才能生效!!!

插件

插件开发

只要实现插件接口即可注册使用

  • 接口定义
dart 复制代码
abstract class ManaPluggable {
  /// The unique identifier name for the plugin.
  ///
  /// 插件的唯一标识名。
  String get name;

  /// Returns the localized display name for the plugin.
  /// This supports internationalization.
  ///
  /// 插件在界面上显示的名字,支持国际化。
  String getLocalizedDisplayName(Locale locale);

  /// Called when the plugin is triggered.
  /// This method should contain the plugin's main logic.
  ///
  /// 当插件被触发时调用的方法,执行主要逻辑。
  void onTrigger();

  /// Optionally builds a widget to display the plugin's content within the UI.
  /// Returns `null` if the plugin does not have a visual component.
  ///
  /// 可选地构建一个 Widget,用于在界面中展示该插件的内容。
  /// 如果插件没有可视化组件,则返回 `null`。
  Widget? buildWidget(BuildContext? context);

  /// Returns the [ImageProvider] for the plugin's icon, used for displaying the plugin's visual representation.
  ///
  /// 获取插件图标的 [ImageProvider],用于展示插件图标。
  ImageProvider get iconImageProvider;

  /// Async initialization for the plugin.
  ///
  /// 插件的异步初始化方法
  Future<void> initialize();
}

预览

  • 面板
  • 日志查看器
  • 内存信息

更多功能和预览,请查看链接

相关推荐
程序员老刘6 小时前
从短剧App的bug看响应式编程在AI时代的优势
flutter·ai编程·客户端
恋猫de小郭15 小时前
最近 Android 有什么更新:Android Dev Summit 2026 技术解读
android·前端·flutter
好的佩奇1 天前
Dart 之类修饰符
android·flutter·dart
好的佩奇012 天前
Dart 之类修饰符
android·flutter·dart
Jewel1052 天前
文字为什么总是不居中!记录一个bug
android·flutter·ios
2601_949847752 天前
Form-data 跨端三方库仓颉适配全流程
前端·javascript·flutter
大龄秃头程序员3 天前
Flutter 中我为什么把 GetX 定位为高效率方案,而不是默认架构方案
flutter
传奇开心果编程3 天前
组合优先开发范式:从汉字造字原理到声明式UI组件组合思想
android·flutter·ios·swiftui·移动开发·harmonyos·android jetpack
2501_944521593 天前
Ramda 跨端三方库仓颉适配全流程
开发语言·javascript·flutter·php
大龄秃头程序员3 天前
Flutter 架构里总被混淆的 IoC、DI、Service Locator,到底是什么关系?
flutter