tw_keychain 0.0.1 copy "tw_keychain: ^0.0.1" to clipboard
tw_keychain: ^0.0.1 copied to clipboard

Keychain storage that relies on UICKeyChainStore plug-in.

tw_keychain #

  • Keychain storage that relies on UICKeyChainStore plug-in

Getting Started #


import 'package:tw_keychain/tw_keychain.dart';

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final _twKeyChainPlugin = TwKeyChain();
  String _uuid = '';

  @override
  void initState() {
    super.initState();
    initData();
  }

  initData() async {
    _uuid = await _twKeyChainPlugin.fetchKeyChain(
      key: 'test_uuid',
      service: 'test_service',
    );
    if (_uuid.isEmpty) {
      _uuid = uuid;
      await _twKeyChainPlugin.saveKeyChain(
        key: 'test_uuid',
        value: _uuid,
        service: 'test_service',
      );
    }
    setState(() {});
  }

  /// Random UUID
  String get uuid {
    String randomStr = Random().nextInt(10).toString();
    for (var i = 0; i < 10; i++) {
      var str = Random().nextInt(10);
      randomStr = "$randomStr$str";
    }
    final timeNumber = DateTime.now().millisecondsSinceEpoch;
    final uuid = "$randomStr$timeNumber";
    return uuid;
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Running on: $_uuid'),
        ),
      ),
    );
  }
}

1
likes
150
points
9
downloads

Publisher

unverified uploader

Weekly Downloads

Keychain storage that relies on UICKeyChainStore plug-in.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on tw_keychain

Packages that implement tw_keychain