Skip to content
This repository has been archived by the owner on Aug 7, 2024. It is now read-only.

Update init to take features parameter: Map<String, GBFeature> #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

swiftymf
Copy link
Contributor

Recently the growthbook_sdk_flutter package was updated. This change
removed the ability to "seed" the feature values which are used while
the network request is happening or as fallback if the request fails.

Alongside this work, I have updated the Uptech fork of
growthbook_sdk_flutter to allow passing in "seeded" features and
values at init, instead of after. This commits points the dependency
at the Uptech fork, which is still in review.

Add features param to init constructor.
Add Deprecated tag to seeds so we know, while it is still possible to
use that parameter, we should be using features.
Add comments explaining why we have both params and what changes in
the growthbook_sdk_flutter package inspired these changes.
If a Map is passed in to the seeds param, we convert them to the new
feature Map<String, GBFeature> and pass that map along.
Update the tests to use GBFeature for map values.

@swiftymf swiftymf force-pushed the ps/rr/update_init_to_take_features_parameter__map_string__gbfeature_ branch from 1c0df97 to 7e51216 Compare April 13, 2023 15:27
{Map<String, dynamic>? seeds,
{Map<String, GBFeature> features = const <String, GBFeature>{},
@Deprecated('Instead use "features" as Map<String, GBFeature>')
Map<String, dynamic> seeds = const <String, dynamic>{},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does initForTests not need the combining finalFeatures and seeds functionality that is being done in init? It looks like _createTestClient gets the seeds and features is never used. Is that correct?

pubspec.yaml Outdated
growthbook_sdk_flutter:
git:
url: https://github.com/uptech/GrowthBook-SDK-Flutter.git
ref: master
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll see if we need to go this direction based on the responsiveness of the maintainers of the GrowthBook-SDK-Flutter.

if (seeds.isNotEmpty) {
seeds.forEach((key, value) {
finalFeatures[key] = GBFeature(defaultValue: value);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see any tests that ensure that seeds are still valid, and that they populate growthbook correctly (because they are merged here). Should they be added?

Recently the growthbook_sdk_flutter package was updated. This change
removed the ability to "seed" the feature values which are used while
the network request is happening or as fallback if the request fails.

Alongside this work, I have updated the Uptech fork of
growthbook_sdk_flutter to allow passing in "seeded" features and
values at init, instead of after. This commits points the dependency
at the Uptech fork, which is still in review.

Add features param to init constructor.
Add Deprecated tag to seeds so we know, while it is still possible to
use that parameter, we should be using features.
Add comments explaining why we have both params and what changes in
the growthbook_sdk_flutter package inspired these changes.
If a Map is passed in to the seeds param, we convert them to the new
feature Map<String, GBFeature> and pass that map along.
Update the tests to use GBFeature for map values.

<!-- ps-id: 9fb1da74-fa5f-4ba5-a05e-ddebf7f970b6 -->
@swiftymf swiftymf force-pushed the ps/rr/update_init_to_take_features_parameter__map_string__gbfeature_ branch from 7e51216 to b1d9a30 Compare August 8, 2023 16:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants