sodium_libs 2.2.1+4 copy "sodium_libs: ^2.2.1+4" to clipboard
sodium_libs: ^2.2.1+4 copied to clipboard

Flutter companion package to sodium that provides the low-level libsodium binaries for easy use.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:sodium_libs/sodium_libs.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  static const resultTextKey = Key('resultText');

  final Sodium? preInitSodium;

  const MyApp({
    super.key,
    this.preInitSodium,
  });

  @override
  Widget build(BuildContext context) => MaterialApp(
        title: 'sodium_libs example app',
        home: Scaffold(
          appBar: AppBar(
            title: const Text('sodium_libs example app'),
          ),
          body: Center(
            child: FutureBuilder<Sodium>(
              future: preInitSodium != null
                  ? Future.value(preInitSodium)
                  : SodiumInit.init(),
              builder: (context, snapshot) {
                if (snapshot.hasData) {
                  return Text(
                    'Loaded libsodium with version ${snapshot.data!.version}',
                    key: resultTextKey,
                  );
                }

                if (snapshot.hasError) {
                  return Text(
                    'Failed to load libsodium with error: ${snapshot.error}\n'
                    '${snapshot.stackTrace}',
                    key: resultTextKey,
                    style: TextStyle(color: Colors.red.shade900),
                  );
                }

                return const CircularProgressIndicator();
              },
            ),
          ),
        ),
      );
}
16
likes
0
pub points
89%
popularity

Publisher

verified publisherskycoder42.de

Flutter companion package to sodium that provides the low-level libsodium binaries for easy use.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

args, flutter, flutter_web_plugins, html, js, meta, plugin_platform_interface, sodium, synchronized

More

Packages that depend on sodium_libs