sodium_libs 3.3.0+2 copy "sodium_libs: ^3.3.0+2" to clipboard
sodium_libs: ^3.3.0+2 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
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

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