Skip to content
Back to archipelago.banuacoder.com

Infrastructure SDKs

utilities_sdk Free ​

Tier
Freeversion 4.1.8
Command
archipelago generate utilities_sdk
Generates
  • shared/utilities/device_info/device_info_api (if selected)
  • shared/utilities/device_info/device_info_impl (if selected)
  • shared/utilities/package_info/package_info_api (if selected)
  • shared/utilities/package_info/package_info_impl (if selected)
Generates first
test_prereq, package_info_providerwhen needed and missing, so there is nothing to install first

Device info (pre-resolved sync getters) and package info (installerSource, buildSignature) with an API/Impl split. Biometric handling has moved to auth_sdk — this brick has no biometric variable or templates.

What it is ​

Two independent, individually-toggleable utility SDKs generated under utilities/ (or shared/utilities/ in a monorepo): device_info (platform + device snapshot) and package_info (app version/build metadata, installer source, build signature). Most projects generate both once, early, alongside flutter_modular_monorepo.

Variables ​

VariableTypeDefaultDescription
appNamestringMyAppApplication name
organizationstringMyCompanyYour organization or company name
domainstringcomYour organization's top-level domain
prefixstring(none — required prompt)Unique prefix for component naming
includeDeviceInfobooleantrueInclude device information utilities
includePackageInfobooleantrueInclude package information utilities
isForMonorepobooleantrueWhether this will be part of a monorepo structure
includeGeneratedbooleanfalseWhether to include generated files in version control

There is no includeBiometric variable — an earlier version of this page documented one, but it does not exist in brick.yaml. Biometric authentication now ships as the separate biometric_auth_sdk brick.

Prerequisites ​

hooks/pre_gen.dart runs ArchipelagoConfigGuard.requireExists() and exits with an error if the project has no archipelago.yaml yet — generate flutter_modular_monorepo (or another brick that creates it) first. With includePackageInfo: true, pre_gen also self-generates package_info_provider via SubBrickGenerator if infrastructure/package_info_provider is missing, since package_info_impl relies on that brick's single global PackageInfo registration.

Usage ​

Interactive ​

bash
archipelago generate utilities_sdk

Non-interactive (CI) ​

bash
archipelago generate utilities_sdk --config my_config.json

Generated Structure ​

Each utility is a separate API/Impl pair under utilities/ — or shared/utilities/ when isForMonorepo is true.

When includeDeviceInfo is true:

text
utilities/
└── device_info/
    ├── device_info_api/
    │   ├── lib/
    │   │   ├── device_info_api.dart
    │   │   └── src/
    │   │       ├── device_info.dart           # DeviceInfo model
    │   │       ├── device_info_service.dart   # DeviceInfoService contract
    │   │       └── device_platform.dart       # DevicePlatform enum
    │   └── pubspec.yaml
    └── device_info_impl/
        ├── lib/
        │   ├── device_info_impl.dart
        │   └── src/
        │       ├── di/
        │       │   ├── injector.dart
        │       │   └── register_module.dart
        │       └── utils/
        │           └── device_info_impl.dart  # DeviceInfoImpl
        ├── build.yaml
        └── pubspec.yaml

When includePackageInfo is true:

text
utilities/
└── package_info/
    ├── package_info_api/
    │   ├── lib/
    │   │   ├── package_info_api.dart
    │   │   └── src/
    │   │       ├── installer_source.dart       # InstallerSource enum
    │   │       └── package_info_util.dart      # PackageInfoUtil contract
    │   └── pubspec.yaml
    └── package_info_impl/
        ├── lib/
        │   ├── package_info_impl.dart
        │   └── src/
        │       ├── di/
        │       │   └── injector.dart
        │       └── utils/
        │           └── package_info_impl.dart  # PackageInfoImpl
        ├── build.yaml
        └── pubspec.yaml

Public API ​

Device info ​

dart
abstract interface class DeviceInfoService {
  DeviceInfo get info;               // synchronous — resolved once at boot via @preResolve
}

DeviceInfo carries platform (DevicePlatform: ios/android/web/macOS/windows/linux/fuchsia/unknown), osVersion, androidSdkInt, manufacturer, model, modelName, deviceId, isPhysicalDevice, isLowRamDevice. DeviceInfoImpl builds it once from device_info_plus's BaseDeviceInfo, pre-resolved via @preResolve in RegisterModule.baseDeviceInfo. There is deliberately no advertising-ID API (removed in 4.0.0): a real one needs its own consent/ATT flow and platform permissions, so use a dedicated ads-attribution SDK (for example AppsFlyer via analytics_sdk) instead.

Package info ​

dart
abstract class PackageInfoUtil {
  String get version;
  String get buildNumber;
  String get appName;
  String get packageName;
  InstallerSource get installerSource; // appStore / playStore / amazonStore / sideloaded / unknown
  String get buildSignature;           // APK signing cert (Android) / provisioning profile id (iOS) / '' otherwise
}

PackageInfoImpl takes the PackageInfo registered by package_info_provider (it no longer registers its own) and maps installerStore to InstallerSource (com.android.vending → playStore, com.amazon.venezia → amazonStore, com.apple.appstore/appstore → appStore, empty/null → unknown, anything else → sideloaded).

Wiring ​

hooks/post_gen.dart (skipped when isForMonorepo is false) registers each generated package pair into the melos workspace, adds the device_info_impl/package_info_impl path dependencies to the host app, and registers DeviceInfoImplPackageModule / PackageInfoImplPackageModule in the app's injector.dart. Both packages declare these modules in their archipelago: di_modules manifest so generate host-registry keeps them. It then appends utilities_sdk to archipelago.yaml's installed-bricks list via ArchipelagoConfigHelper.

Dependencies ​

device_info_plus (^13.2.0), package_info_plus (^10.2.1), injectable/get_it. package_info_impl depends at runtime on the package_info_provider brick (self-generated).

Limitations ​

  • No advertising ID: DeviceInfoService.advertisingId() was removed in 4.0.0 (it was a stub that always returned null).
  • Generating utilities_sdk with includePackageInfo: true next to feedback_sdk or rating_review_sdk is safe: all of them share the single PackageInfo registration from package_info_provider.
  • There is nothing biometric in this brick; see biometric_auth_sdk.

Testing ​

device_info_impl does platform I/O while the injector initialises (@preResolve on DeviceInfoPlugin). It declares a DeviceInfoTestPrerequisite in lib/testing.dart, which swaps in a fake DeviceInfoPlatform. The generated injector_test installs it for you. The fake serves macOS and Linux hosts. See test prerequisites.

Changelog ​

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