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 engine
  • Policy — authorization rules per model type
  • Feature / AsyncFeature — feature flag definitions
  • GateContext — scoped user context
  • Hooks, annotations, and testing utilities

Documentation

Full guides: flutter_gate docs

Libraries

flutter_gate_core