flutter_root_detection_plus 0.0.1
flutter_root_detection_plus: ^0.0.1 copied to clipboard
Flutter Root Detection for Both Android and IOS which does not run the application on root or sudo.
flutter_root_detection_plus #
This package provides a simple way to check if the device is rooted or jailbroken, and whether developer options are enabled.
This package is an enhanced version of the original flutter_root_detection
package, with additional features and improvements.
To check if the device is rooted / jailBroken #
import 'package:flutter_root_detection_plus/flutter_root_detection_plus.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final isRooted = await FlutterRootDetectionPlus().getIsJailBroken();
if (isRooted) {
print('Device is rooted');
} else {
print('Device is not rooted');
}
}
To check if the device has developer options enabled #
This method works only for Android
devices. iOS devices do not have a concept of developer options in the same way.
import 'package:flutter_root_detection_plus/flutter_root_detection_plus.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final hasDevOptions = await FlutterRootDetectionPlus().getIsDevMode();
if (hasDevOptions) {
print('Device has developer options enabled');
} else {
print('Device does not have developer options enabled');
}
}
To check if app is running in virtual devices #
import 'package:flutter_root_detection_plus/flutter_root_detection_plus.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final isVirtual = await FlutterRootDetectionPlus().getIsVirtualDevice();
if (isVirtual) {
print('App is running in a virtual device');
} else {
print('App is not running in a virtual device');
}
}
Installation #
Add the following to your pubspec.yaml
file:
dependencies:
flutter_root_detection_plus: ^1.0.0
or run the following command in your terminal:
flutter pub add flutter_root_detection_plus
Usage #
Import the package in your Dart code:
import 'package:flutter_root_detection_plus/flutter_root_detection_plus.dart';
Then, you can use the FlutterRootDetectionPlus
class to check if the device is rooted or jailbroken.