A library for accessing the Secret Manager API.

Getting started

First create a service account and download the JSON key file.

Then, add this package to your pubspec.yaml file:



To use the GoogleSecretManager class, you first need to initialize it via the GoogleSecretManagerInitializer class. You can do this by calling the GoogleSecretManagerInitializer.initViaServiceAccountJson method and passing the downloaded JSON key file as a string:

final path = '${Directory.current.path}/service-account.json';
final file = File(path);
final json = await file.readAsString();
await GoogleSecretManagerInitializer.initViaServiceAccountJson(json);

Then, you can access the secret value by calling the GoogleSecretManager.get method:

final response = await GoogleSecretManager.instance.get('secret-name');

For more information you can see a full example in the example folder.

Additional information

If you're interested in contributing to the development of this package, I welcome your contributions! One way to do so is by submitting a pull request (PR) on our GitHub repository.

To get started, you'll need to fork the repository to your own GitHub account. Then, make your changes or additions in a new branch on your forked repository. Once you've made your changes, you can submit a pull request to my main repository.

We encourage you to include a detailed description of your changes, along with any relevant documentation and tests. I will review your pull request and provide feedback as needed.


A library for accessing the Secret Manager API.