// This file initializes the dynamic library and connects it with the stub // generated by flutter_rust_bridge_codegen. import 'dart:ffi'; import 'dart:io' show Platform; import 'bridge_generated.dart'; import 'bridge_definitions.dart'; // Re-export the bridge so it is only necessary to import this file. export 'bridge_definitions.dart'; export 'bridge_generated.dart'; const _libName = 'native'; /// Use for Darwin framework lookup. /// Use an explicit package constant to avoid /// if the library name and the package name are not the same. /// The value must be equal to the package name defined in pubspec.yaml. const _package = 'native'; final _dylib = switch (Platform.operatingSystem) { 'ios' || 'macos' => '$_package.framework/$_package', 'android' || 'linux' => 'lib$_libName.so', 'windows' => '$_libName.dll', _ => throw UnsupportedError( 'unsupported operating system ${Platform.operatingSystem}', ), } final Native api = NativeImpl(_dylib);