in google_cloud/example/example.dart [29:57]
static Future<_Server> create() async {
String? projectId;
bool hosted;
try {
projectId = await projectIdFromMetadataServer();
hosted = true;
} on BadConfigurationException {
projectId = projectIdFromEnvironment();
hosted = false;
}
if (projectId == null) {
throw BadConfigurationException(
'''
Could not contact GCP metadata server or find the project-id in one of these
environment variables:
${gcpProjectIdEnvironmentVariables.join('\n ')}''',
);
}
print('Current GCP project id: $projectId');
final authClient = await clientViaApplicationDefaultCredentials(
scopes: [FirestoreApi.datastoreScope],
);
return _Server._(projectId: projectId, client: authClient, hosted: hosted);
}