root_jailbreak_check 0.0.1
root_jailbreak_check: ^0.0.1 copied to clipboard
On-device root (Android) and jailbreak (iOS) detection. Pure Kotlin/Swift heuristics, no bundled native binaries, no network calls, no third-party services.
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:root_jailbreak_check/root_jailbreak_check.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _status = 'Checking...';
@override
void initState() {
super.initState();
initPlatformState();
}
// Platform messages are asynchronous, so we initialize in an async method.
Future<void> initPlatformState() async {
final compromised = await RootJailbreakCheck.isJailbroken();
// If the widget was removed from the tree while the asynchronous platform
// message was in flight, we want to discard the reply rather than calling
// setState to update our non-existent appearance.
if (!mounted) return;
setState(() {
_status = compromised
? 'Device is rooted/jailbroken'
: 'Device looks clean';
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('root_jailbreak_check example'),
),
body: Center(
child: Text(_status),
),
),
);
}
}