搜索插件、代码仓与 APP 分类

插件详情v2.0.4

root

Flutter 插件,用于检查 Android 设备的 Root 状态并在 Android 上运行 shell 命令(仅限 Android),仅建议在短时间内执行操作时使用此插件。

Android
近 30 天下载
1620
喜欢数
36
Pub 分数
150

安装插件

flutter pub add root

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

根包是一个Flutter插件,可启用检查Android设备的root状态并仅在Android上执行shell命令。它专为短时操作设计,例如验证设备完整性或在特定任务期间运行系统级命令。该插件利用原生Android功能,提供可靠的root检测和命令执行。不支持iOS。开发者应谨慎使用,仅用于短暂过程,以避免性能或安全问题。

适合场景

  • 检查 Android 设备是否已获取 root 权限
  • 在 Android 上运行临时 shell 命令
  • 验证设备安全状态
  • 执行系统级脚本(短暂)
  • 在应用启动期间验证设备完整性

主要特点

  • 检测 Android 是否已 root
  • 在 Android 上执行 shell 命令
  • 轻量级,适用于短时进程
  • 使用原生 Android API
  • 无 iOS 支持

适合对象

  • 仅限 Android 的应用需要 root 检查
  • 安全敏感的应用程序
  • 需要临时 shell 访问权限的工具
  • 开发调试工具
  • 应用验证设备状态

使用建议

  • 仅适用于 Android
  • 不适用于长时间运行的进程
  • 需要谨慎处理 shell 输出
  • 在访问受限的非根设备上可能失败
  • 仅限 Android 平台

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

root plugin

CodeFactor

A Flutter Plugin to check Android device Root status and Run shell commands in android(only).
This plugin is based on Topjohnwu libsu and Stericson Root Tools.

Usage

To use this plugin, add root as a dependency in your pubspec.yaml file.
 root: ^2.0.4
import it
import 'package:root/root.dart';
Declare a async method to check root status
bool _status = false;

 Future<void> checkRoot() async {
    bool result = await Root.isRooted();
    setState(() {
      _status = result;
    });
  }
  
 later you can use _status in your code to let app know the root status. 
 
Declare a async method to check Su on System
bool _status = false;

 Future<void> checkRoot() async {
    bool result = await Root.isRootAvailable();
    setState(() {
      _status = result;
    });
  }
  
 later you can use _status in your code to let app know the root status. 
 
Declare a async method to run shell commands
use this function only for short period of processes, don't use for long processes else app may crash
String _result;

 Future<void> setCommand() async {
    String res = await Root.exec(cmd: "cat /proc/version");
    setState(() {
      _result = res;
    });
  }
  
  later you can use the _result in your code to let know the output of the given shell command.
 
issues
  • Please file the issues you found. Thank you.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。