buildFlutterFireCommand static method
Builds the flutterfire command string with appropriate parameters.
Constructs a properly formatted flutterfire command with all the required and optional parameters.
Parameters:
config: Firebase configuration parameters
Returns: Formatted flutterfire command string
Example:
// Build flutterfire command from configuration
final config = {
'project_id': 'my-project',
'platform': 'android,ios',
'android_package_name': 'com.example.myapp',
'ios_bundle_id': 'com.example.myapp',
};
final command = FirebaseHelper.buildFlutterFireCommand(config);
print('Generated command: $command');
// Execute the command
await command.run;
Implementation
static String buildFlutterFireCommand(FirebaseConfig firebaseConfig) {
final project = firebaseConfig.projectId;
final token = firebaseConfig.token;
final platform = firebaseConfig.platform;
final output = firebaseConfig.output;
final androidPackageName = firebaseConfig.androidPackageName;
final iosBundleId = firebaseConfig.iosBundleId;
final webAppId = firebaseConfig.webAppId;
final argToken = token is String && token.isNotEmpty ? ' -t "$token"' : '';
final argPlatform = platform is String && platform.isNotEmpty
? ' --platforms="$platform"'
: '';
final argWebAppId =
webAppId is String && webAppId.isNotEmpty ? ' -w "$webAppId"' : '';
final argOutput =
output is String && output.isNotEmpty ? ' -o "$output"' : '';
return 'flutterfire configure $argToken$argPlatform$argWebAppId$argOutput '
'-p "$project" '
'-a "$androidPackageName" '
'-i "$iosBundleId" '
'-m "$iosBundleId" '
'-w "$androidPackageName" '
'-x "$androidPackageName" '
'-y';
}