createCanister static method

Future<Principal> createCanister(
  1. CallConfig? config
)

Implementation

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