https://www.growthbook.io/ logo
#sdk-flutter
Title
# sdk-flutter
c

cool-apple-97384

03/17/2023, 4:11 AM
Hi @gifted-cat-24658 may I know, maybe we need any additional setup when implement Growthbook for Flutter web? Because I always got error
unknownFeature
, please see image attached. We have declared the feature on our dashboard with defaultValue. I think, growthbook should return defaultValue.
g

gifted-cat-24658

03/17/2023, 6:36 AM
Thanks, @cool-apple-97384 there is no additional steps for GrowthBook flutter SDK to work on flutter web as it’s purely written in dart. So behaviour would be independent of platform. I would like to know how we are using this in client, a small snippet on that would be help full. Thanks.
c

cool-apple-97384

03/17/2023, 6:38 AM
Hi @gifted-cat-24658 thanks for the response this code instance GrowthBookSDK, we create a wrapper again using another class
Copy code
Get.put<GrowthBook>(
      GrowthBook(
        apiHost: 'OUR_API_HOST',
        apiKey: growthBookApiKey,
        isQAMode: kDebugMode,
        attributes: {
          Constant.idAttribute: userId,
        },
        trackingCallback: (experiment, result) {
          DigiproTrackerUtil.growthBookTracking(
            tracker: Get.find<TrackAvo>(),
            experiment: experiment,
            result: result,
          );
        },
      ),
      permanent: true,
    );
We use Growthbook 1.1.2
g

gifted-cat-24658

03/17/2023, 7:05 AM
• Make sure that feature is enabled for environment with you are working with. • You can check logs in your console if growthbook has retrieved feature from the server. • Make sure to put
await
key word before calling
gb.refresh()
. Can you prefer this, to make sure you have latest set of the feature in SDK.
c

cool-apple-97384

03/17/2023, 7:21 AM
Hi @gifted-cat-24658 I was check all environment is enabled, you can see attached image on this thread
How to enable logs for growthbook?
When I must call refresh? Every load the app?
We use SDK version 1.1.2 not the latest
g

gifted-cat-24658

03/20/2023, 11:25 AM
• Hey, by default there is logging enabled in debug mode when SDK gets initialized and when the feature flags has been fetched. You can refer first screen shot from attached screen shot. • I have used same version of 1.1.2 GB and I have create feature on dev, and I can see all information related to GrowthBook result. Check screenshot 2 and 3. • You, must call
refresh
in your main, and you should await for that so get all features before other app services starts so you can use that. Let us know it solves your problem. If it doesn’t then we are waiting for your issue on gb repo with code of conduct. Thanks.
c

cool-apple-97384

03/20/2023, 11:30 AM
Hi @gifted-cat-24658 thanks for the confirmation. So, any changes in the growthbook system or architechture? In the previous aproach we can still get updated value without calling refresh method. So, why for now we need to call refresh first before use growthbook? This changes will impact for older app.
g

gifted-cat-24658

03/20/2023, 11:33 AM
The process to set feature in previous version of SDK is async internally for which you can not wait. But in recent we exposed that async api to user so, can await for feature to be fetched.
So, In previous version this was at level of refresh callback, so we have made this at SDK initialization level.
So, in recent version 2.0.0. Check
await
keyword before
GBSDKBuilderApp
.
Copy code
gb = await GBSDKBuilderApp(
      apiKey: kReleaseMode ? '<PROD_KEY>' : '<DEV_KEY>',
      hostURL: '<HOST_URL>',
      attributes: userAttr,
      growthBookTrackingCallBack: (exp, rst) {},
    ).initialize();
Would work as aspected.
c

cool-apple-97384

03/20/2023, 11:36 AM
I see, maybe when we call a feature method growthbook proccess internally have not finished?
g

gifted-cat-24658

03/20/2023, 11:37 AM
Yes, in previous version.
c

cool-apple-97384

03/20/2023, 11:38 AM
Ok thanks @gifted-cat-24658 for the support. This issue was solved after we call refresh method manually after instance Growthbook SDK.
We can’t upgrade to Growthbook v2 because any issue in Flutter Web. You can see that I created in the repository github.
g

gifted-cat-24658

03/22/2023, 6:28 AM
@cool-apple-97384 We have created another patch for SDK, for addressed issue on the repository, now you can update your GrowthBook SDK.
c

cool-apple-97384

03/22/2023, 9:04 AM
Hi @gifted-cat-24658 thanks
23 Views