Search packages, repositories and app categories

Package detailsv2.0.4

root

Flutter Plugin to check Android device Root status and Run shell commands in android(only), use this plugin only for short period of processes.

Android
30-day downloads
1.6K
Likes
36
Pub points
150

Install package

flutter pub add root

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

The root package is a Flutter plugin that enables checking the root status of an Android device and executing shell commands on Android only. It's designed for short-lived operations, such as verifying device integrity or running system-level commands during specific tasks. The plugin leverages native Android capabilities to provide reliable root detection and command execution. It does not support iOS. Developers should use it cautiously and only for brief processes to avoid performance or security issues.

Use cases

  • Checking if an Android device is rooted
  • Running temporary shell commands on Android
  • Verifying device security status
  • Executing system-level scripts briefly
  • Validating device integrity during app startup

Key features

  • Detects Android root status
  • Executes shell commands on Android
  • Lightweight for short processes
  • Uses native Android APIs
  • No iOS support

Suitable for

  • Android-only apps requiring root checks
  • Security-sensitive applications
  • Tools needing temporary shell access
  • Development debugging utilities
  • Apps validating device state

Considerations

  • Only works on Android
  • Not suitable for long-running processes
  • Requires careful handling of shell output
  • May fail on non-rooted devices with restricted access
  • Limited to Android platform

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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.

Categories

Source repository

Projects using this package

No data available yet.