flutter_key_generator 0.0.6 flutter_key_generator: ^0.0.6 copied to clipboard
Secure unique 128, 192, 256 bit key generator for Flutter iOS & Android.
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:flutter_key_generator/flutter_key_generator.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
void genUniqueKey() async {
try {
final key = await FlutterKeyGenerator.generateSymmetricKey(256);
print(key);
} catch (e) {
print(e);
}
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Plugin example app'),
),
body: Center(
child: Text('Running on:'),
),
floatingActionButton: FloatingActionButton(
onPressed: genUniqueKey,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
),
);
}
}