byFlavor static method

Map byFlavor(
  1. String flavor,
  2. String pathMorphemeYaml
)

Retrieves Firebase configuration for a specific flavor.

This method extracts the Firebase configuration for a given flavor from the morpheme.yaml configuration file. The configuration typically includes project ID, platform settings, and other Firebase-specific options.

Parameters:

  • flavor: The flavor/environment to get configuration for
  • pathMorphemeYaml: Path to the morpheme.yaml configuration file

Returns: A map containing the Firebase configuration for the specified flavor

Example:

// Get Firebase configuration for production
final config = FirebaseHelper.byFlavor('prod', './morpheme.yaml');
final projectId = config['project_id'];
print('Production Firebase project ID: $projectId');

Implementation

static Map<dynamic, dynamic> byFlavor(
    String flavor, String pathMorphemeYaml) {
  final yaml = YamlHelper.loadFileYaml(pathMorphemeYaml);
  final Map<dynamic, dynamic> mapFlavor = yaml['firebase'] ?? {};
  return mapFlavor[flavor] ?? {};
}