16.2%
38.4%
2.2%
37.8%
-11.6%
37.5%
97.4%
9.3%
-11.4%
100%
14.1%
100%
100%
33%
14.2%
-48.2%
-46.7%
-11.6%
-82.9%
-84.4%
I am facing an issue when I use firebase to authenticate with GCP Secret Manager in Flutter:
[VERBOSE-2:ui_dart_state.cc(209)] Unhandled Exception: Null check operator used on a null value
#0 clientViaApplicationDefaultCredentials (package:googleapis_auth/auth_io.dart:77:49)
On Mac I launch in iTerm:
export GOOGLE_APPLICATION_CREDENTIALS="PATH_TO_JSON_FILE/service-account-file.json"
Then my code is:
import 'package:googleapis/secretmanager/v1.dart';
import 'package:googleapis_auth/auth_io.dart' as auth;
import 'package:googleapis/firestore/v1.dart';
final client = await auth.clientViaApplicationDefaultCredentials(scopes: [FirestoreApi.cloudPlatformScope]);
final api = SecretManagerApi(client);
final secrets = await api.projects.secrets.versions.access('my_secret_key');
print(secrets.payload!.data.toString());
When I launch the app, I have Platform.environment['GOOGLE_APPLICATION_CREDENTIALS']: null
What is the proper ways to set this variable?
I am trying to copy an image file from app's Documents directory to assets folder in Flutter.
CODE SNIPPET:
Directory appDocumentsDirectory = await getApplicationDocumentsDirectory();
String appDocumentsPath = appDocumentsDirectory.path;
// copy to asset folder first
File sourceFile = File('$appDocumentsPath/${widget.basename}');
final copied = await sourceFile.copy('assets/images/${widget.basename}');
// copied file to assets folder
but its showing some error. Then how can i copy the imageFile ?
ERROR :
Restarted application in 4,309ms.
E/flutter ( 5930): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: FileSystemException: Cannot copy file to 'assets/images/image1.png', path = '/data/user/0/com.example.photo_manager/app_flutter/image1.png' (OS Error: No such file or directory, errno = 2)