搜尋套件、儲存庫與 APP 分類

套件詳情v2.0.4

root

Flutter 插件,用於檢查 Android 裝置的 Root 狀態並在 Android(僅限 Android)上執行 shell 命令,僅建議在短時間內執行作業時使用此插件。

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.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。