initFromSodiumJS2 static method

Future<SodiumSumo> initFromSodiumJS2(
  1. FutureOr<LibSodiumJS> getLibsodium()
)

Creates a SodiumSumo instance for the loaded libsodium returned by the callback as LibSodiumJS.

The getLibsodium parameter must be a factory method that returns a loaded sumo variant of sodium.js. Please refer to the README for more details on loading the library.

Unlike the initFromSodiumJS method, this one enables the use of SodiumSumo.runIsolated. Use it preferably.

Implementation

static Future<SodiumSumo> initFromSodiumJS2(
  FutureOr<LibSodiumJS> Function() getLibsodium,
) async =>
    SodiumSumoJS(await getLibsodium());