legal_device 1.0.6 copy "legal_device: ^1.0.6" to clipboard
legal_device: ^1.0.6 copied to clipboard

A Flutter plugin for detecting the legality of the device(Jailbroken, root, emulator).

example/lib/main.dart

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

import 'package:legal_device/legal_device.dart';

void main() => runApp(MyApp());

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

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  bool isJailBroken = false;
  bool isRealDevice = true;
  bool isOnExternalStorage = false;
  bool isLegalDevice = false;
  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
//    String platformVersion;

    // 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;

    // Platform messages may fail, so we use a try/catch PlatformException.ßß
    try{
      isJailBroken = await legalDevice.isJailBroken;
      isRealDevice = await legalDevice.isRealDevice;
      isOnExternalStorage = await legalDevice.isOnExternalStorage;
      isLegalDevice = await legalDevice.isLegalDevice;
    }catch(error){
      print(error);
    }

    setState(() {
      isJailBroken = isJailBroken;
      isRealDevice = isRealDevice;
      isOnExternalStorage = isOnExternalStorage;
      isLegalDevice = isLegalDevice;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Device trust fall check'),
        ),
        body: Center(
          child: Card(
             child: Padding(
               padding: const EdgeInsets.all(8.0),
               child: Column(
                 mainAxisAlignment: MainAxisAlignment.center,
                 mainAxisSize: MainAxisSize.min,
                 children:<Widget>[
                   Row(
                     mainAxisAlignment: MainAxisAlignment.center,
                     children: <Widget>[
                       Text('isJailBroken():'),
                       SizedBox(
                         width: 8,
                       ),
                       Text('${isJailBroken ? "Yes" : "No"}', style: TextStyle(fontWeight: FontWeight.w600),),
                     ],
                   ),
                   SizedBox(
                     height: 8,
                   ),
                   Row(
                     mainAxisAlignment: MainAxisAlignment.center,
                     children: <Widget>[
                       Text('isRealDevice():'),
                       SizedBox(
                         width: 8,
                       ),
                       Text('${isRealDevice ? "Yes" : "No"}', style: TextStyle(fontWeight: FontWeight.w600),),
                     ],
                   ),
                   SizedBox(
                     height: 8,
                   ),
                   Row(
                     mainAxisAlignment: MainAxisAlignment.center,
                     children: <Widget>[
                       Text('isOnExternalStorage():'),
                       SizedBox(
                         width: 8,
                       ),
                       Text('${isOnExternalStorage ? "Yes" : "No"}', style: TextStyle(fontWeight: FontWeight.w600),),
                     ],
                   ),SizedBox(
                     height: 8,
                   ),
                   Row(
                     mainAxisAlignment: MainAxisAlignment.center,
                     children: <Widget>[
                       Text('isLegalDevice():'),
                       SizedBox(
                         width: 8,
                       ),
                       Text('${isLegalDevice ? "Yes" : "False"}', style: TextStyle(fontWeight: FontWeight.w600),),
                     ],
                   ),
                 ] ,
               ),

             ),
          ),
        ),
      ),
    );
  }
}
0
likes
40
points
16
downloads

Publisher

verified publisherglobecyber.com

Weekly Downloads

A Flutter plugin for detecting the legality of the device(Jailbroken, root, emulator).

Homepage

License

MIT (license)

Dependencies

flutter

More

Packages that depend on legal_device

Packages that implement legal_device