Developer

Feature flags

This package aims to create an implementation of FLAGD http2 provider based on package openfeature.

Features

  • http/http2
  • InMemoryCache

Installation

dart pub add eit_flagd_provider -u https://gitea.whitelabel.mobile.embedit.dev/api/packages/platform/pub/

!IMPORTANT You need access token for fetching from private pub repository. ELI add token automatically

Usage

To use eit_flagd_provider you need initialize service and provide configuration.

final service = await EitFlag.http(
    Config(
      host: 'x4osswow8ogo4g4s08scwg80.zoocityboy.space',
      maxRetries: 3,
      onLogEvent: logger.info,
    ),
  );

How to get values

We need to get value of feature flag and decide what's happen in our code. We supports all types supported by flagd now.

// bool value
final value = client.getBooleanValue('myBoolFlag', false);
/// String value
final value = client.getStringValue('myStringFlag', 'none');
/// num value
final value = client.getNumberValue('myFloatFlag', 123.0);
final value = client.getNumberValue('myIntFlag', 123);
/// object value
final value = client.getObjectValue('myObjectFlag',Value.empty());

How to add context to query

This is sample definition of the flag on backend side.

    "fibAlgo": {
      "variants": {
        "recursive": "recursive",
        "memo": "memo",
        "loop": "loop",
        "binet": "binet"
      },
      "defaultVariant": "recursive",
      "state": "ENABLED",
      "targeting": {
        "if": [
          {
            "$ref": "emailWithFaas"
          },
          "binet",
          null
        ]
      }
    },
    "$evaluators": {
    "emailWithFaas": {
      "in": [
        "@faas.com",
        {
          "var": ["email"]
        }
      ]
    }
  }

Query

now we can run our request with default value.


/// standard request
final value = client.getStringValue('fibAlgo','#cccccc');
/// > returns `recursive`

Or we can provide specific context for this flag.

/// request with specific context
client.getStringValue('fibAlgo','#cccccc',evaluationContext: ImmutableContext.fromAttributes({"email": Value.fromString("abc@faas.com")}))
/// > returns `binet`

How to fetch all flags on start

You can initialze connection on start of the app

final service = await EitFlag.http(
    Config(
      host: 'x4osswow8ogo4g4s08scwg80.zoocityboy.space',
      maxRetries: 3,
      onLogEvent: logger.info,
    ),
  );
/// run prefetch, start connection on http2 
service.initialize();

Copyright © 2025. All rights reserved.