projectIdFromEnvironmentVariables function

String? projectIdFromEnvironmentVariables()

Returns the Project ID for the current Google Cloud Project by checking the environment variables in projectIdEnvironmentVariableOptions.

The list is checked in order. This is useful for local development.

If no matching variable is found, null is returned.

Implementation

String? projectIdFromEnvironmentVariables() {
  for (var key in projectIdEnvironmentVariableOptions) {
    final value = Platform.environment[key];
    if (value != null && value.isNotEmpty) {
      return value;
    }
  }

  return null;
}