root_jailbreak_detector 0.5.3 copy "root_jailbreak_detector: ^0.5.3" to clipboard
root_jailbreak_detector: ^0.5.3 copied to clipboard

Flutter Plugin To Detect Root and Jailbreak on Android-iOS Devices

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:io' show Platform;

import 'package:flutter/services.dart';
import 'package:root_jailbreak_detector/root_jailbreak_detector.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 rootedOrJailbreaked = 'Unknown';

  ///Initialize Detector
  final _rootJailbreakDetectorPlugin = RootJailbreakDetector();

  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  Future<void> initPlatformState() async {
    bool? root;
    bool? jailbreak;

    try {
      ///Platform check for detection
      if (Platform.isAndroid) {
        /// isRooted is used to set [root]
        root = (await _rootJailbreakDetectorPlugin.isRooted() ?? false);
      } else if (Platform.isIOS) {
        /// isJailbreaked is used to set [jailbreak]
        jailbreak =
            (await _rootJailbreakDetectorPlugin.isJailbreaked() ?? false);
      }
    }

    /// You can catch error from native code with [PlatformException]
    on PlatformException {
      root = false;
      jailbreak = false;
    }

    if (!mounted) return;

    setState(() {
      rootedOrJailbreaked =
          "Root Kontrolü $root \nJailbreak Kontrolü $jailbreak ";
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Root - Jailbreak Detector'),
        ),
        body: Center(
          child: Text(rootedOrJailbreaked),
        ),
      ),
    );
  }
}
4
likes
140
pub points
69%
popularity

Publisher

unverified uploader

Flutter Plugin To Detect Root and Jailbreak on Android-iOS Devices

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on root_jailbreak_detector