sodium_libs 3.4.0+1 copy "sodium_libs: ^3.4.0+1" to clipboard
sodium_libs: ^3.4.0+1 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
160
points
1.84k
downloads

Publisher

verified publisherskycoder42.de

Weekly Downloads

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

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

More

Packages that depend on sodium_libs