initRustLibForTests function

Future<void> initRustLibForTests({
  1. bool preferRelease = true,
  2. String? checkoutRelativeRustDir,
})

Initializes FRB against a real cdylib. Safe to call from multiple test files' setUpAllRustLib.init is idempotent once loaded.

Implementation

Future<void> initRustLibForTests({
  bool preferRelease = true,
  String? checkoutRelativeRustDir,
}) async {
  WidgetsFlutterBinding.ensureInitialized();
  final lib = await resolveRustLibPath(
    release: preferRelease,
    checkoutRelativeRustDir: checkoutRelativeRustDir,
  );
  await RustLib.init(
    externalLibrary: ExternalLibrary.open(lib),
  );
}