updateFlag method

Features<T> updateFlag(
  1. T feat,
  2. bool active
)

Implementation

Features<T> updateFlag(T feat, bool active) {
  final List<FeatureFlag<T>> newFlags = List.from(flags);
  newFlags.removeWhere((flag) => flag.feature == feat);
  if (active || (defaultOn.contains(feat) && !active)) {
    newFlags.add(FeatureFlag(feature: feat, active: active));
  }
  _log.info('new active $newFlags, $defaultOn');
  return Features(flags: newFlags, defaultOn: defaultOn);
}