https://github.com/icapps/flutter_remote_config_generator
https://github.com/icapps/flutter_remote_config_generator
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/icapps/flutter_remote_config_generator
- Owner: icapps
- License: other
- Created: 2025-02-21T09:37:58.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-02-21T15:23:17.000Z (over 1 year ago)
- Last Synced: 2025-02-21T15:32:27.324Z (over 1 year ago)
- Language: C++
- Size: 1000 Bytes
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
A generator that helps you generate code for your remote config, currently only firebase is supported.
## Features
Generates the nescessary code for accessing your remote config
## Getting started
To get started you need 2 things, first is a firebase service account key of a service account that has access to the remote config. Second is a config.yaml file stored in the remote_config_generator folder in the root of your project.
The file should look something like this
```yaml
credentials_path: path to credentials (ex. remote_config_generator/credentials.json)
project_id: project id of your firebase project
```
After that just run the tool by running this command:
```bash
flutter packages run remote_config_generator
```
This will generate 3 files. remote_config_base.dart, remote_config_data.dart and remote_config_keys.dart. To then use these generated files create a class which extends the remoteConfigBase like this:
```dart
class RemoteConfig extends RemoteConfigBase {
RemoteConfig._();
@override
@protected
Future refreshRemoteConfig() async {
// Refresh remote config here
}
@override
String? getOptionalValue(String key) {
// Get the value out of your remote config (doesn't have to be from firebase)
}
}
```
Now all you have to do is initialize the remote config and call the values:
```dart
final remoteConfig = RemoteConfig();
remoteConfig.init();
remoteConfig.values.{valueName}
```
It is advised to make the RemoteConfig a singleton so you always access the same values.