constructFromMaker<T extends Construct<RevaliDirectory<AnyFile>>> method

Future<T?> constructFromMaker<T extends Construct<RevaliDirectory<AnyFile>>>(
  1. ConstructMaker maker
)

Implementation

Future<T?> constructFromMaker<T extends Construct>(
  ConstructMaker maker,
) async {
  final revaliConfig = await this.revaliConfig;
  final config = revaliConfig.configFor(maker);

  final result = maker.maker(config.constructOptions);

  if (result is! T) {
    throw Exception(
      'Invalid type for construct! ${result.runtimeType} '
      'must be of type $T',
    );
  }

  return result;
}