root_detector 0.0.6 copy "root_detector: ^0.0.6" to clipboard
root_detector: ^0.0.6 copied to clipboard

A library to check root access/jailbreak in android & ios device

example/lib/main.dart

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:root_detector/root_detector.dart';

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  String _isRooted = 'Unknown';

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

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      await RootDetector.isRooted(
        busyBox: true,
        ignoreSimulator: false,
      ).then((value) {
        setState(() {
          _isRooted = value.toString();
        });
      });
    } on PlatformException {
      setState(() {
        _isRooted = 'Failed to get root status.';
      });
    }
  }

  @override
  void setState(VoidCallback fn) {
    if (mounted) {
      super.setState(fn);
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Root Detector'),
        ),
        body: Center(
          child: Text('Device is Rooted: $_isRooted\n'),
        ),
      ),
    );
  }
}
8
likes
150
pub points
44%
popularity

Publisher

verified publisherwisnuwiry.space

A library to check root access/jailbreak in android & ios device

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on root_detector