Created
June 26, 2022 09:30
-
-
Save RyanDsilva/6e457d537f02400078be6eb5c6c51050 to your computer and use it in GitHub Desktop.
Checking for Root / Jailbreak
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:io'; | |
import 'package:flutter/services.dart'; | |
import 'package:flutter_jailbreak_detection/flutter_jailbreak_detection.dart'; | |
Future<bool> checkJailbrokenOrRooted() async { | |
bool jailbrokenOrRooted = true; | |
try { | |
if (Platform.isAndroid) { | |
jailbrokenOrRooted = await FlutterJailbreakDetection.developerMode; | |
} else if (Platform.isIOS) { | |
jailbrokenOrRooted = await FlutterJailbreakDetection.jailbroken; | |
} else { | |
jailbrokenOrRooted = true; | |
} | |
return jailbrokenOrRooted; | |
} on PlatformException { | |
jailbrokenOrRooted = true; | |
return jailbrokenOrRooted; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment