flutter_gate_core
Core policy and feature flag engine for Flutter. Pure Dart — no Flutter SDK required.
Part of the flutter_gate monorepo.
Installation
dependencies:
flutter_gate_core: ^0.1.1
For widgets and BuildContext extensions, use flutter_gate instead — it re-exports this package.
Usage
import 'package:flutter_gate_core/flutter_gate_core.dart';
void main() {
gate.policy<Post>(() => PostPolicy());
gate.define(const DarkModeFeature());
if (gate.allows('update', user: 'alice', model: Post('alice'))) {
// authorized
}
}
API
Gate/gate— singleton enginePolicy— authorization rules per model typeFeature/AsyncFeature— feature flag definitionsGateContext— scoped user context- Hooks, annotations, and testing utilities
Documentation
Full guides: flutter_gate docs