setFeature static method

void setFeature(
  1. BuildContext context,
  2. String id,
  3. bool isEnabled
)

Allows to enable or disable the feature with the given id.

Its new isEnabled status is saved into local preferences and so it is persisted between app sessions.

Implementation

static void setFeature(
  BuildContext context,
  String id,
  bool isEnabled,
) async {
  final state = context.findAncestorStateOfType<_FeaturesState>();
  await state!.setFeature(id, isEnabled);
}