computeProjectId function
A convenience wrapper that first tries projectIdFromEnvironment
then (if the value is null
) tries projectIdFromMetadataServer
Like projectIdFromMetadataServer, if no value is found, a BadConfigurationException is thrown.
Implementation
Future<String> computeProjectId() async {
final localValue = projectIdFromEnvironment();
if (localValue != null) {
return localValue;
}
final result = await projectIdFromMetadataServer();
return result;
}