Shared Packages
core_infrastructure_package Free
- Tier
- Freeversion 2.0.10
- Command
archipelago generate core_infrastructure_package- Generates
shared/core_infrastructure_sdk/core_infrastructure_apishared/core_infrastructure_sdk/core_infrastructure_impl
- Used by
- auth_sdk, paywall_sdk
Essential core infrastructure SDK providing foundation for modular Flutter apps — DI setup,
Either/Failure/BaseUseCasebase patterns, and a configuredlogger-backedLoggersingleton. Every other feature/SDK brick builds on these types.
Variables
| Variable | Type | Default | Description |
|---|---|---|---|
| appName | string | MyApp | Application name for identification and naming |
| organization | string | MyCompany | Your organization or company name |
| domain | string | com | Your organization's top-level domain |
| prefix | string | — | Unique prefix for component naming |
| isForMonorepo | boolean | true | Whether this SDK will be generated for a monorepo structure |
| includeGenerated | boolean | false | Whether generated files should be included in version control |
Usage
Interactive
bash
archipelago generate core_infrastructure_packageNon-interactive (CI)
bash
archipelago generate core_infrastructure_package --config my_config.jsonConfig 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.yamlPublic 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.loggerprovides a@lazySingleton Loggerbacked bypackage:logger'sPrettyPrinter(colors, emojis, 2-frame method traces).appLoggerand thelogDebug/logInfo/logWarning/logErrorextension methods onObject(incore_infrastructure_impl'slogger.dart) read this singleton fromgetIt.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 tokDebugMode) andSimpleLogPrinter(a minimal emoji+message printer) exist incore_infrastructure_impl/lib/src/log/but are not wired intoRegisterModule.logger— the generatedLoggeralways usesPrettyPrinterwith no filter, so verbose/colored logging is not stripped in release builds despite the filter class existing for exactly that purpose.CoreInjectorKeydeclareshttpClientandsecureStoragestring keys alongsidelogger, 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.