ff_flutter_client_sdk 1.0.1 copy "ff_flutter_client_sdk: ^1.0.1" to clipboard
ff_flutter_client_sdk: ^1.0.1 copied to clipboard

outdated

Feature Flag Management platform from Harness. Flutter SDK can be used to integrate with the platform in your Flutter applications.

example/README.md

Harness CF Flutter SDK Example usage #

Setup #

To install SDK, declare a dependency to project's pubspec.yaml file:

ff_flutter_client_sdk: ^1.0.1

Then, you may import package to your project

import 'package:ff_flutter_client_sdk/CfClient.dart';

After this step, the SDK elements, primarily CfClient, should be accessible in main application.

Example #

final conf = CfConfigurationBuilder()
    .setStreamEnabled(true)
    .setPollingInterval(60) //time in seconds (minimum value is 60)
    .build();
final target = CfTargetBuilder().setIdentifier(name).build();

final res = await CfClient.initialize(apiKey, conf, target);


//get number evaluation
final numberEvaluation = await CfClient.numberVariation("demo_number_evaluation", 0);

//get string evaluaation
final stringEvaluation = await CfClient.stringVariation("demo_string_evaluation", "default");

//get json evaluation
final jsonEvaluation = await CfClient.jsonVariation("demo_json_evaluation", {});

CfClient.registerEventsListener((responseData, eventType) {
    _eventListener = (responseData, eventType){};
    switch (eventType) {
      case EventType.SSE_START:
        print("Started SSE");
        break;
      case EventType.SSE_END:
        print("SSE Completed");
        break;
      case EventType.EVALUATION_CHANGE:
        String flag = (responseData as EvaluationResponse).flag;
        dynamic value = (responseData as EvaluationResponse).value;

        break;
      case EventType.EVALUATION_POLLING:
        List pollingResult = responseData;

        pollingResult.forEach((element) {
          String flag = (element as EvaluationResponse).flag;
          dynamic value = (element as EvaluationResponse).value;

        });
        break;
    }
});

//Shutting down SDK
CfClient.destroy()

2
likes
0
pub points
34%
popularity

Publisher

verified publisherharness.io

Feature Flag Management platform from Harness. Flutter SDK can be used to integrate with the platform in your Flutter applications.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on ff_flutter_client_sdk