inject static method
Inject js module that required by this package by injectionType
. Optinally version
can be provided, otherwise latest
is used.
void main() async {
await FlutterWeb3.inject(FlutterWeb3InjectionTypes.ethers);
runApp(MyApp());
}
Implementation
static Future<void> inject(FlutterWeb3InjectionTypes injectionType,
[String version = 'latest']) async {
AMDJS.verbose = false;
await AMDJS.require(
injectionType.module,
jsFullPath: injectionType.path.replaceFirst(r'latest', version),
globalJSVariableName: injectionType.variable,
);
}