codesa_apk_guard 0.2.2
codesa_apk_guard: ^0.2.2 copied to clipboard
Native Android security and anti-tampering checks for Flutter applications.
import 'package:codesa_apk_guard/codesa_apk_guard.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const GuardDemo());
}
class GuardDemo extends StatefulWidget {
const GuardDemo({super.key});
@override
State<GuardDemo> createState() => _GuardDemoState();
}
class _GuardDemoState extends State<GuardDemo> {
GuardReport? report;
bool loading = false;
Future<void> runCheck() async {
setState(() => loading = true);
try {
final result = await CodesaApkGuard.check(
config: const ApkGuardConfig(
checks: {
ThreatType.codeHooking,
ThreatType.securityConfigManipulation,
ThreatType.sourceCodeModification,
ThreatType.applicationRepackaging,
ThreatType.applicationDebugging,
ThreatType.rootedDevice,
ThreatType.appCloningEnvironment,
ThreatType.malwareCheatTool,
ThreatType.emulator,
ThreatType.usbDebugging,
ThreatType.speedModification,
},
),
);
setState(() => report = result);
} finally {
setState(() => loading = false);
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: const Text('CODESA APK Guard')),
body: Padding(
padding: const EdgeInsets.all(16),
child: Column(
children: [
FilledButton(
onPressed: loading ? null : runCheck,
child: Text(loading ? 'Analizando...' : 'Ejecutar análisis'),
),
const SizedBox(height: 16),
if (report != null)
Expanded(
child: ListView(
children: report!.findings.map((finding) {
return ListTile(
title: Text(finding.type.name),
subtitle: Text(finding.details),
trailing: Icon(
finding.detected ? Icons.warning : Icons.check,
),
);
}).toList(),
),
),
],
),
),
),
);
}
}