init method

  1. @override
Future<Either<Failure, Unit>> init({
  1. required String page,
})
override

Implementation

@override
Future<Either<Failure, Unit>> init({required String page}) async {
  try {
    await create.page(page);
    await create.main(page);
    await create.analysisOptions();
    await create.injectionContainer();
    await create.routerGo(page);
    await create.navigation();
    await create.clean();
    await create.either();
    await create.failure();
    await pubspec.clean();
    for (final p in Packages.values) await pubspec.addPackage(p.name);
    for (final p in DevPackages.values) await pubspec.addPackage(p.name);
    return const Right(unit);
  } on IOFailure catch (e) {
    return Left(e);
  } on ReaderFailure catch (e) {
    return Left(e);
  } catch (e) {
    return Left(UnknownFailure(cause: e.toString()));
  }
}