Skip to content

A Flutter Plugin to check Android device Root status and execute shell commands with root privileges

License

Notifications You must be signed in to change notification settings

AnthonyZitoTegoshi-Evosystems/root

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

A Flutter Plugin to check Android device Root status and execute shell commands with root privileges

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 56.5%
  • Java 43.5%