Skip to main content

device_safety_info 2.0.0 copy "device_safety_info: ^2.0.0" to clipboard
device_safety_info: ^2.0.0 copied to clipboard

Flutter device security - root/jailbreak, hook and debugger detection, Play Integrity and App Attest tokens, screenshot and clipboard protection, VPN checks.

example/lib/main.dart

import 'package:device_safety_info/device_safety_info.dart';
import 'package:material_ui/material_ui.dart';

import 'home_page.dart';

/// Optional: your signing certificate, to try the tampering check.
/// `flutter run --dart-define=EXPECTED_SIGNING_CERT=<sha-256>`
const _expectedCert = String.fromEnvironment('EXPECTED_SIGNING_CERT');

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Optional. Without it, every check uses safe defaults.
  await DeviceSafety.initialize(
    DeviceSafetyConfig(
      // Trusted apps that should never be reported:
      accessibilityAllowlist: {'com.google.android.marvin.talkback'},
      // Your list of known malware and bad domains:
      malwarePackages: {'com.example.fakemalware'},
      iocBlocklist: {'malicious.example', '*.phishing.example'},
      // Your real signing certificate, for the tampering check:
      expectedSigningCertificates: {
        if (_expectedCert.isNotEmpty) _expectedCert,
      },
    ),
  );

  runApp(const ExampleApp());
}

class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Device Safety Info',
      debugShowCheckedModeBanner: false,
      theme: _theme(Brightness.light),
      darkTheme: _theme(Brightness.dark),
      home: const HomePage(),
    );
  }
}

/// Teal from the app icon. Problems and errors use the scheme's red `error` color.
const _iconTeal = Color(0xFF00796B);

ThemeData _theme(Brightness brightness) {
  final scheme = ColorScheme.fromSeed(
    seedColor: _iconTeal,
    brightness: brightness,
    // Keep teal vivid like the icon instead of Material's muted tone.
    dynamicSchemeVariant: DynamicSchemeVariant.fidelity,
  );
  return ThemeData(
    colorScheme: scheme,
    // Teal app bar, like the icon background.
    appBarTheme: AppBarTheme(
      backgroundColor: brightness == Brightness.light
          ? _iconTeal
          : scheme.surfaceContainer,
      foregroundColor: brightness == Brightness.light
          ? Colors.white
          : scheme.onSurface,
    ),
  );
}
38
likes
0
points
3.32k
downloads

Publisher

verified publishertherivanta.com

Weekly Downloads

Flutter device security - root/jailbreak, hook and debugger detection, Play Integrity and App Attest tokens, screenshot and clipboard protection, VPN checks.

Repository (GitHub)
View/report issues

Topics

#security #root-detection #jailbreak-detection #privacy #device-integrity

License

unknown (license)

Dependencies

code_assets, crypto, flutter, hooks, logging, meta, native_toolchain_c

More

Packages that depend on device_safety_info

Packages that implement device_safety_info