Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ciriousjoker/fake_firebase_remote_config
Flutter package: Fake Firebase Remote Config for use during Flutter unit & widget tests.
https://github.com/ciriousjoker/fake_firebase_remote_config
fake firebase firebaseremoteconfig flutter flutter-test flutter-tests mock remoteconfig
Last synced: about 1 month ago
JSON representation
Flutter package: Fake Firebase Remote Config for use during Flutter unit & widget tests.
- Host: GitHub
- URL: https://github.com/ciriousjoker/fake_firebase_remote_config
- Owner: ciriousjoker
- License: bsd-2-clause
- Created: 2022-01-07T06:08:03.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-08-08T14:22:10.000Z (3 months ago)
- Last Synced: 2024-08-09T15:00:31.522Z (3 months ago)
- Topics: fake, firebase, firebaseremoteconfig, flutter, flutter-test, flutter-tests, mock, remoteconfig
- Language: Dart
- Homepage: https://pub.dev/packages/fake_firebase_remote_config
- Size: 39.1 KB
- Stars: 3
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Fake Firebase Remote Config
[![pub package](https://img.shields.io/pub/v/fake_firebase_remote_config.svg)](https://pub.dartlang.org/packages/fake_firebase_remote_config)
Fakes to write unit tests for Firebase Remote Config. Instantiate a `FakeRemoteConfig`, then pass it around your project to replace `RemoteConfig.instance`. This fake acts like `RemoteConfig` except it will load mocked data instead.
## Usage
### A simple usage example
```dart
import 'package:fake_firebase_remote_config/fake_firebase_remote_config.dart';void main() async {
final config = FakeRemoteConfig();
await config.setDefaults({
// ...
});config.loadMockData({
// ...
});await config.fetchAndActivate();
}
```This `config` object needs to replace the real `RemoteConfig.instance` during testing. You can do this for example with [Riverpod](https://pub.dev/packages/riverpod) or by doing something like this:
```dart
await tester.pumpWidget(
MaterialApp(
title: 'RemoteConfig Example',
home: MyApp(overrideRemoteConfig: config),
),
);
```## Missing functionality
- `config.app` will throw
- `config.pluginConstants` will throw
- `config.getValue(String key)` will throw if the key is missing
- Everything related to `config.settings` serve no purpose. Data is loaded manually.## Compatibility table
| firebase_remote_config | fake_firebase_remote_config |
| ---------------------- | --------------------------- |
| >=0.9.0-dev.0 <4.0.0 | 1.0.x |
| >=4.0.0 <5.0.0 | 2.0.x |
| >=4.0.0 <5.0.0 | 2.1.x |Last updated for `firebase_remote_config: 4.2.5`.
## Features and bugs
Please file feature requests and bugs at the [issue tracker](https://github.com/CiriousJoker/fake_firebase_remote_config/issues).