init static method

Future<Sodium> init(
  1. FutureOr getLibsodium()
)

Creates a Sodium instance for the loaded libsodium returned by the callback.

The getLibsodium parameter must be a factory method that returns a loaded [lib]sodium.[so|dll|dylib|a|lib|js]- depending on your platform. Please refer to the README for more details on loading the library.

Implementation

static Future<Sodium> init(
  FutureOr<dynamic> Function() getLibsodium,
) async =>
    initFromSodiumJS(
      () async => (await getLibsodium()) as LibSodiumJS,
    );