Skip to content
Back to archipelago.banuacoder.com

Shared Packages

core_infrastructure_package Free ​

Tier
Freeversion 2.0.10
Command
archipelago generate core_infrastructure_package
Generates
  • shared/core_infrastructure_sdk/core_infrastructure_api
  • shared/core_infrastructure_sdk/core_infrastructure_impl

Essential core infrastructure SDK providing foundation for modular Flutter apps — DI setup, Either/Failure/BaseUseCase base patterns, and a configured logger-backed Logger singleton. Every other feature/SDK brick builds on these types.

Variables ​

VariableTypeDefaultDescription
appNamestringMyAppApplication name for identification and naming
organizationstringMyCompanyYour organization or company name
domainstringcomYour organization's top-level domain
prefixstring—Unique prefix for component naming
isForMonorepobooleantrueWhether this SDK will be generated for a monorepo structure
includeGeneratedbooleanfalseWhether generated files should be included in version control

Usage ​

Interactive ​

bash
archipelago generate core_infrastructure_package

Non-interactive (CI) ​

bash
archipelago generate core_infrastructure_package --config my_config.json

Config Template ​

json
{
  "@appName": "Application name for identification and naming",
  "appName": "MyApp",
  "@organization": "Your organization or company name",
  "organization": "MyCompany",
  "@domain": "Your organization's top-level domain",
  "domain": "com",
  "@prefix": "Unique prefix for component naming",
  "prefix": "App",
  "@isForMonorepo": "Whether this SDK will be generated for a monorepo structure",
  "isForMonorepo": true,
  "@includeGenerated": "Whether generated files should be included in version control",
  "includeGenerated": false
}

Generated Structure ​

text
shared/
└── core_infrastructure_sdk/
    ├── core_infrastructure_api/
    │   ├── lib/
    │   │   ├── core_infrastructure_api.dart
    │   │   └── src/
    │   │       ├── base/
    │   │       │   ├── base_use_case.dart
    │   │       │   └── either.dart
    │   │       ├── failures/
    │   │       │   └── failure.dart
    │   │       └── log/
    │   │           ├── log.dart
    │   │           └── log_type.dart
    │   ├── analysis_options.yaml
    │   └── pubspec.yaml
    └── core_infrastructure_impl/
        ├── lib/
        │   ├── core_infrastructure_impl.dart
        │   └── src/
        │       ├── di/
        │       │   ├── injector.dart
        │       │   └── register_module.dart
        │       ├── log/
        │       │   ├── filter/
        │       │   │   ├── filter.dart
        │       │   │   └── release_log_filter.dart
        │       │   ├── log.dart
        │       │   └── printer/
        │       │       ├── printer.dart
        │       │       └── simple_log_printer.dart
        │       └── utils/
        │           ├── core_injector_key.dart
        │           ├── extensions.dart
        │           ├── logger.dart
        │           └── utils.dart
        ├── analysis_options.yaml
        ├── build.yaml
        └── pubspec.yaml

Public API ​

dart
// Result type — Failure on the left, success value on the right
Future<Either<Failure, User>> getUser(String id) async { ... }

result.fold(
  (failure) => print(failure.message),
  (user) => print(user.name),
);
result.rightOrNull; // User? — null on Left
result.map((user) => user.name); // Either<Failure, String>

// Repository-backed use case
class GetUserUseCase extends BaseUseCase<User, String, UserRepository> {
  GetUserUseCase({required super.repo});

  @override
  Future<Either<Failure, User>> call(String id) => repo.getUser(id);
}

// Logging
import 'package:core_infrastructure_impl/core_infrastructure_impl.dart';

logError('failed to load', error, stackTrace);
logInfo('user logged in');

Failure is a plain {message, errno} value type with fromJson/toJson/copyWith. BaseUseCaseNoParam<Result, Repository> is the same pattern for use cases that take no parameters.

DI & Wiring ​

  • RegisterModule.logger provides a @lazySingleton Logger backed by package:logger's PrettyPrinter (colors, emojis, 2-frame method traces). appLogger and the logDebug/logInfo/logWarning/logError extension methods on Object (in core_infrastructure_impl's logger.dart) read this singleton from getIt.
  • setupCoreInfrastructureDependencies() is annotated @microPackageInit — call it early in the app's DI bootstrap alongside other micro-packages.

Dependencies ​

core_infrastructure_impl: logger ^2.7.0, get_it ^9.2.1, injectable ^3.0.0. core_infrastructure_api: meta only (no Flutter dependency).

Platform Setup ​

None required.

Limitations ​

  • ReleaseLogFilter (gates logging to kDebugMode) and SimpleLogPrinter (a minimal emoji+message printer) exist in core_infrastructure_impl/lib/src/log/ but are not wired into RegisterModule.logger — the generated Logger always uses PrettyPrinter with no filter, so verbose/colored logging is not stripped in release builds despite the filter class existing for exactly that purpose.
  • CoreInjectorKey declares httpClient and secureStorage string keys alongside logger, but this package registers only the logger — the other two keys are not used by anything generated here.

Changelog ​

Run archipelago brick info core_infrastructure_package to see the latest published version. Enterprise customers can read the full CHANGELOG.md in the brick source repository.