flutter_gate
Flutter widgets and extensions for the flutter_gate policy and feature flag system.
Part of the flutter_gate monorepo. Re-exports flutter_gate_core.
Installation
dependencies:
flutter_gate: ^0.1.1
Usage
import 'package:flutter_gate/flutter_gate.dart';
void main() {
gate.policy<Post>(() => PostPolicy());
gate.define(const DarkModeFeature());
runApp(const MyApp());
}
Can(
ability: 'update',
user: userId,
model: post,
child: EditButton(),
)
FeatureGuard<DarkModeFeature>(
child: DarkPanel(),
)
Widgets
Can/Cannot— authorization guardsFeatureGuard/FeatureGuardAsync— feature togglesFeatureValue/FeatureValueAsync— read feature values in UIBuildContextextensions —context.can(),context.featureEnabled()