protect_app 0.0.1
protect_app: ^0.0.1 copied to clipboard
protect app from screenshots, proxy, vpn, developer mode, root and Jail broken
example/lib/main.dart
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:protect_app/protect_app.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await ProtectApp().turnOffScreenshots();
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final _protectAppPlugin = ProtectApp();
bool isDeviceUseVPN = false;
bool isUseJailBrokenOrRoot = false;
bool isDeviceUseTurnOnTheDeveloperMode = false;
Map dataOfProxyDeviceUse = {};
@override
void initState() {
super.initState();
initPlatformState();
}
Future<void> initPlatformState() async {
try {
bool tempIsDeviceUseVPN =
await _protectAppPlugin.isDeviceUseVPN() ?? false;
bool tempIsUseJailBrokenOrRoot =
await _protectAppPlugin.isUseJailBrokenOrRoot() ?? false;
bool checkIsTheDeveloperModeOn =
await _protectAppPlugin.checkIsTheDeveloperModeOn() ?? false;
Map dataOfCurrentProxy =
await _protectAppPlugin.dataOfCurrentProxy() ?? {};
setState(() {
isDeviceUseVPN = tempIsDeviceUseVPN;
isUseJailBrokenOrRoot = tempIsUseJailBrokenOrRoot;
isDeviceUseTurnOnTheDeveloperMode = checkIsTheDeveloperModeOn;
dataOfProxyDeviceUse = dataOfCurrentProxy;
});
} on PlatformException {}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Column(
children: [
Text('is the device use vpn:$isDeviceUseVPN'),
Text(
'is the device use jailBroken or root:$isUseJailBrokenOrRoot'),
Text(
'is the device use turn on the developer mode:$isDeviceUseTurnOnTheDeveloperMode'),
Text('data of the proxy use:$dataOfProxyDeviceUse'),
],
),
),
),
);
}
}