createCanister static method
Implementation
static Future<Principal> createCanister(CallConfig? config) async {
final canister = getManagementCanister(
config ?? CallConfig(),
);
ActorMethod? func =
canister.getFunc("provisional_create_canister_with_cycles");
// ignore: prefer_typing_uninitialized_variables
var result;
if (func != null) {
result = await func.call([
{"amount": [], "settings": []}
]);
}
var canisterId = Principal.from(result['canister_id']);
return canisterId;
}