Coder Social home page Coder Social logo

printeastwoodcz / bullet_train_flutter Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 0.0 225 KB

License: MIT License

Kotlin 0.24% Swift 0.76% Objective-C 0.07% Dart 94.93% Ruby 2.53% Shell 1.47%
flutter feature-flags features traits feature-flag feature-flagging feature-flaggers remote-config ci cd

bullet_train_flutter's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

bullet_train_flutter's Issues

Keys are not being picked up

We've integrated flagsmith with our Flutter client recently. We've been stuck for two days now with the value returning null for isFeatureFlagEnabled and false for hasFeatureFlag. This works perfectly fine on the website implementation. Below is the Service we're using and the logic to fetch the values.

@singleton

/// A wrapper service for the Bullet train library
class FlagsmithService {
  final log = getLogger('FlagsmithService');
  final _sharedPreferences = locator<SharedPreferencesService>();

  final _bulletTrainClient = BulletTrainClient(
    apiKey: FlavorConfig.instance.values.bulletTrainEnvironmentApiKey,
    config: BulletTrainConfig(
      isDebug: true,
    ),
  );

  bool _isSSOEnabled = false;
  bool _isThirdPartyEnabled = false;
  bool _isGoogleAuthEnabled = false;
  bool _isFacebookAuthEnabled = false;
  bool _isAppleAuthEnabled = false;

  Future initialise() async {
    _isSSOEnabled = await _getFeatureEnabled('auth');
    _isThirdPartyEnabled = await _getFeatureEnabled('third-party');
    _isGoogleAuthEnabled = await _getFeatureEnabled('google-login');
    _isFacebookAuthEnabled = await _getFeatureEnabled('facebook-login');
    _isAppleAuthEnabled = await _getFeatureEnabled('apple-login');
  }

  bool get isSSOEnabled => true; //_isSSOEnabled;
  bool get isThirdPartyEnabled => _isThirdPartyEnabled;
  bool get isGoogleAuthEnabled => _isGoogleAuthEnabled;
  bool get isFacebookAuthEnabled => _isFacebookAuthEnabled;
  bool get isAppleAuthEnabled => _isAppleAuthEnabled;

  Future<bool> _getFeatureEnabled(String key) async {
    final user = FeatureUser(
      identifier: _sharedPreferences.idempotencyKey,
    );

    var featureEnabledValue =
        await _bulletTrainClient.isFeatureFlagEnabled(key, user: user);

    var hasFeature = await _bulletTrainClient.hasFeatureFlag(key, user: user);

    log.d('hasFeature:$hasFeature key:$key');

    return featureEnabledValue ?? false;
  }
}

We triple double quadruple checked the api key and it's correct. We have tried a different one. One other thing to note is that it's not printing out any logs or throwing any exceptions. I've set isDebug to true but there's no logs to be found in the Debug Console.

isFeatureFlagEnabled removed from BulletTrain Client

The code below was what we use to use to check if a feature is enabled.

var featureEnabledValue =
        await _bulletTrainClient.isFeatureFlagEnabled(key);

What do we use now to replace this. The getFeatureFlagValue returns a key but we need a bool and don't want any magic / const strings in our app that's depending on user input.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.