install static method
Implementation
static void install(
FieldOptions fields,
ActorConfig config,
) async {
final mode = fields.mode ?? CanisterInstallMode.Install;
// Need to transform the arg into a number array.
final arg = fields.arg != null
? Uint8List.fromList([...?fields.arg])
: Uint8List.fromList([]);
// Same for module.
final wasmModule = Uint8List.fromList([...fields.module]);
final canisterId = config.canisterId ?? Principal.fromText('');
final canister = getManagementCanister(config);
await canister.getFunc("install_code")!.call([
{
"mode": {mode: null},
"arg": arg,
"wasm_module": wasmModule,
"canister_id": canisterId,
}
]);
}