As Flutter apps grow in complexity, security becomes critical—especially when dealing with sensitive data, banking apps, or enterprise solutions. One major threat? Jailbroken (iOS) or rooted (Android) devices, which bypass security measures and expose your app to exploits.
Why Detect Jailbreak/Root?
Prevent reverse engineering (tampering, cheating, piracy).
Secure financial transactions (block rooted devices in banking apps).
Comply with security policies (HIPAA, PCI-DSS).
How to Detect Jailbreak/Root in Flutter
1. Using Plugins (Easy Mode)
[flutter_jailbreak_detection](https://pub.dev/packages/flutter_jailbreak_detection):
bool isJailbroken = await FlutterJailbreakDetection.jailbroken;
bool isRooted = await FlutterJailbreakDetection.developerMode; // Android
- [root_check](https://pub.dev/packages/root_check): Lightweight root detection.
2. Advanced Manual Checks (Platform Channels)
For custom detection logic, use platform channels to call native code:
Android (Kotlin):
fun isRooted(): Boolean {
val paths = arrayOf("/system/bin/su", "/system/xbin/su", "/sbin/su")
return paths.any { File(it).exists() }
} iOS (Swift):
func isJailbroken() -> Bool {
return FileManager.default.fileExists(atPath: "/Applications/Cydia.app")
} Limitations & Workarounds
⚠ False positives: Some legit devices may trigger checks (e.g., Xiaomi devs).
⚠ Advanced users can hide root/jailbreak (Magisk, Kernbypass).
✅ Defense in depth: Pair with certificate pinning, RASP (Runtime App Self-Protection).



