flutter_root_detection 1.0.0 copy "flutter_root_detection: ^1.0.0" to clipboard
flutter_root_detection: ^1.0.0 copied to clipboard

Flutter Root Detection for Both Android and IOS which does not run the application on root or sudo

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';

import 'package:flutter/services.dart';
import 'package:flutter_root_detection/flutter_root_detection.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  bool? _jailbroken;
  bool? _developerMode;

  @override
  void initState() {
    super.initState();
    checkDetection();
  }
/// [checkDetection] Checks for Root Detection
  Future<void> checkDetection() async {
    try {
      _jailbroken = await FlutterRootDetection.jailbroken;
      _developerMode = await FlutterRootDetection.developerMode;
      setState(() {});
    } on PlatformException {
      _jailbroken = true;
      _developerMode = true;
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Text('Running JailBreak: $_jailbroken'),
            Text('Running DeveloperMode: $_developerMode'),
          ],
        ),
      ),
    );
  }
}
18
likes
140
points
61
downloads

Publisher

verified publisheravinashgotluru.me

Weekly Downloads

Flutter Root Detection for Both Android and IOS which does not run the application on root or sudo

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_root_detection