A Flutter plugin to simulate native crash. Also can be used to check jailbreak/root/debug/emulator status.
Add this to your package's pubspec.yaml file:
dependencies:
native_crash: latest
import 'package:native_crash/native_crash.dart';
// Simulate a native crash.
void crash() {
NativeCrash.crash();
}
import 'package:native_crash/native_crash.dart';
// Check if device is rooted/jailbroken.
bool isJailBroken = await NativeCrash.checkJailBreak();
import 'package:native_crash/native_crash.dart';
// Check if device has developer mode enabled.
bool isDevMode = await NativeCrash.checkDevMode();
import 'package:native_crash/native_crash.dart';
// Check if device is emulator.
bool isEmulator = await NativeCrash.checkEmulator();
import 'package:native_crash/native_crash.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
crashOnJailBreak(
() async {
runApp(MyApp());
},
/// you can also provide a custom widget to show when jailbreak/root detected instead of crashing the app
onRootJailBreakDetected:(){
print("Root/Jailbreak detected");
runApp(RootJailBreakApp());
}
);
}
import 'package:native_crash/native_crash.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
crashOnDevMode(
() async {
runApp(MyApp());
},
/// you can also provide a custom widget to show when developer mode detected instead of crashing the app
onDevModeDetected:(){
print("Developer mode detected");
runApp(DevModeApp());
},
);
}
import 'package:native_crash/native_crash.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
crashOnEmulator(
() async {
runApp(MyApp());
},
/// you can also provide a custom widget to show when emulator detected instead of crashing the app
onEmulatorDetected:(){
print("Emulator detected");
runApp(EmulatorApp());
},
);
}