createAndInstallCanister static method

dynamic createAndInstallCanister(
  1. Service interfaceFactory,
  2. FieldOptions fields,
  3. CallConfig? config
)

Implementation

static createAndInstallCanister(
  Service interfaceFactory,
  FieldOptions fields,
  CallConfig? config,
) async {
  final canisterId = await createCanister(config);

  final newConfig = ActorConfig()
    ..agent = config?.agent
    ..canisterId = canisterId
    ..effectiveCanisterId = config?.effectiveCanisterId
    ..pollingStrategyFactory = config?.pollingStrategyFactory;

  install(fields, newConfig);

  return createActor(interfaceFactory, newConfig);
}