Skip to content

Instantly share code, notes, and snippets.

@RyanDsilva
Created June 26, 2022 09:30
Show Gist options
  • Save RyanDsilva/6e457d537f02400078be6eb5c6c51050 to your computer and use it in GitHub Desktop.
Save RyanDsilva/6e457d537f02400078be6eb5c6c51050 to your computer and use it in GitHub Desktop.
Checking for Root / Jailbreak
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