pullSecretsAs<T> method
Pulls secrets and maps them to a typed object via fromMap.
Use this together with a generated secrets class:
final secrets = await client.pullSecretsAs(AppSecrets.fromMap);
print(secrets.databaseUrl);
Generate the secrets class with:
bella secrets generate dart --types
When fallbackOnError is true (default) and the request fails (e.g. no
network), an empty map is returned instead of throwing — safe for mobile.
Implementation
Future<T> pullSecretsAs<T>(
T Function(Map<String, String>) fromMap, {
String? projectRef,
String? environmentSlug,
bool fallbackOnError = true,
}) async {
final raw = await pullSecrets(
projectRef: projectRef,
environmentSlug: environmentSlug,
fallbackOnError: fallbackOnError,
);
return fromMap(raw);
}