SINT

SINT Framework

State · Injection · Navigation · Translation
High-performance, Clean Architecture micro-framework for Flutter.

pub package License: MIT GitHub Sponsors

English Spanish Arabic French Portuguese Russian Japanese Chinese Korean Indonesian Turkish Vietnamese


The Four Pillars

SINT focuses strictly on four foundational pillars—no HTTP client, validators, or unrelated bloat:

Pillar Core APIs Guide
S — State SintController, Obx, .obs, Sint.computed, Sint.batch, RxFuture, SintStatus, SintView State Docs
I — Injection Bind.contract, Bind.putContract, Sint.put, Sint.lazyPut, Sint.find, Sint.findAll, SintScope, SintService Injection Docs
N — Navigation SintApp, SintPage, SintRoute, SintRouterOutlet, globalMiddlewares, Sint.toNamed, Sint.maybePop, Sint.canPop, Sint.pop, pathParams, queryParams Navigation Docs
T — Translation .tr, .trParams, Translations, Sint.updateLocale, Sint.registerLazyTranslations, translateEndpoints Translation Docs

What's New in 2.2.1

  • Full Navigator-Free Compatibility (Sint.maybePop, Sint.canPop, Safe Sint.pop & Sint.resolveNavigator): Adds context-free Sint.maybePop<T>([result, id]) (closing active overlays first, honoring PopScope(canPop: false), and safely returning false on root routes), Sint.canPop, and canPop()-guarded Sint.pop<T>([result]) so modular Flutter codebases never need direct Navigator.* calls.
  • Automatic MaterialApp / CupertinoApp Host & Widget-Test Fallback: Reusable UI modules calling Sint.to, Sint.off, Sint.toNamed, Sint.offNamed, Sint.back, Sint.pop, Sint.maybePop, Sint.canPop, Sint.dialog, or Sint.bottomSheet resolve SintDelegate in $O(1)$ inside SintMaterialApp / SintApp, and automatically fall back to a mounted host NavigatorState when tested inside standalone MaterialApp / CupertinoApp harnesses.
  • Overlay Queue, MultiBinder & Platform Polish: Synchronous queue cancellation in Sint.closeAllSnackbars() eliminates pending-timer leaks, MultiBinder re-subscribes on dynamic filter updates, SintDesign.auto includes TargetPlatform.macOS, and core/router assertions throw structured StateError / ArgumentError instances.

Highlights from 2.2.0

  • Single-Element MultiBinder ($O(1)$ Widget Depth), Scoped DI & Circular Cycle Guard: Binds collapses $N$ declarative bindings into 1 single MultiBindElement (InheritedModel<Type>) (−95%+ widget-tree depth on modular RootBinding hosts) while keeping Bind.of<T>(context) (including Bind.of<Contract>(context)) $O(1)$ and type-granular. Adds Sint.putContractAsync, SintOverride.contract / contractValue, circular dependency detection (StateError), headless onReady microtask support, SmartManagement.keepFactory lazy preservation, and automatic sibling SintScope isolation across SintView, Obx, Binder, MultiBinder, and SintBuilder.
  • Glitch-Free & Lazy Computed, Single-Slot Obx, everAll & Fast Collections: Tri-color (clean/check/dirty) Computed eliminates diamond glitches inside and outside Sint.batch with optional lazy: true demand evaluation; 1-signal Obx/Computed track dependencies inline with zero Map/Set/List allocations; adds zero-Stream everAll, SintStatus.stackTraceOrNull, single-notification RxList/RxMap bulk mutators, and content-checked RxMap/RxSet.assignAll.
  • Reactive .tr, Zero-Reassemble Sint.updateLocale & Deduplicated Lazy Bundles: .tr is natively reactive inside Obx and Sint.computed, Sint.updateLocale updates active screens in $O(1)$ without WidgetsBinding.performReassemble(), appendTranslations safely clones const maps, and concurrent ensureLocaleLoaded calls share a single in-flight Future.
  • Unified Navigator 2.0 Middlewares, :param+ Routes, package:sint/rx.dart & llms.txt: Synchronous SintMiddleware.redirect() and async redirectDelegate are enforced before stack mutations across all navigation methods (toNamed, offNamed, offNamedUntil, offAndToNamed, offAllNamed, off, offAll), pathParams strictly take precedence over query parameters, :param+ matches multi-segment paths, SintRoute adds .uri(...) and .offAndTo(...), and llms.txt guides AI coding assistants.

Highlights from 2.1.0

  • Contract-First Dependency Injection (Bind.contract / Bind.putContract / aliases:): Bind an abstract service contract S and its concrete controller I extends S to a single shared factory—eliminating 2-line () => Sint.find<Controller>() bridges in modular Clean Architecture apps, plus multi-implementation lookup via Sint.findAt<S>(index) and Sint.findAll<S>(), SintScope overrides, and SintService.
  • Zero-Stream Workers, ValueListenable Interop & RxFuture<T>: Rx and Computed implement Flutter's ValueListenable<T> directly (and read external ValueNotifiers via .rxValue), ever/once/debounce/interval run zero-Stream synchronous callbacks, and sealed SintStatus<T> + RxFuture<T> deliver stale-while-revalidate async state.
  • Global Middlewares & Typed SintRoute<TArgs, TResult>: Apply cross-cutting guards once via globalMiddlewares on SintApp / SintMaterialApp / SintCupertinoApp, and navigate with compile-time typed arguments and results via SintRoute.
  • $O(1)$ Pre-Resolved Locale Cache & Single-Pass .trParams: Zero per-frame locale string allocations in IntlHost, single-pass StringBuffer parameter interpolation, automatic _zero/_other plurals, and Sint.registerLazyTranslations.

Highlights from 2.0.0

  • Standalone Design Systems (SintApp): First-class host for Flutter 3.47+ standalone material_ui and cupertino_ui packages (Flutter >=3.47.0 / Dart ^3.13.0), while preserving SintMaterialApp and SintCupertinoApp. See MIGRATION_DESIGN_SYSTEMS.md.
  • State-of-the-Art Signals Engine (Obx $O(1)$ + batch + computed + untrack): Persistent $O(1)$ Obx listener diffing with automatic conditional-branch pruning, zero-allocation Sint.batch, memoized Sint.computed, and Sint.untrack / rx.peek.
  • Multi-Level Prefix Trie Router: Indexes all leading literal route segments and reuses compiled PathDecoded templates (97.8× faster on 1,000 shared-prefix routes: 250.48 µs → 2.56 µs/op).
  • Nested Routing (SintRouterOutlet): Declarative nested outlets and IndexedRouteBuilder synchronized with imperative Navigator calls.

Quick Start

dependencies:
  sint: ^2.2.1
import 'package:flutter/widgets.dart';
import 'package:material_ui/material_ui.dart';
import 'package:sint/sint.dart';

class CartController extends SintController {
  final items = 1.obs;
  final price = 25.obs;
  late final total = computed(() => items.value * price.value); // Auto-disposed on route close

  void addBundle() => Sint.batch(() {
    items.value += 2;
    price.value = 20;
  });
}

void main() => runApp(
  SintApp(
    materialTheme: ThemeData(),
    initialRoute: '/',
    sintPages: [
      SintPage(
        name: '/',
        binds: [Bind.put(CartController())],
        page: () {
          final c = Sint.find<CartController>();
          return Scaffold(
            body: Center(child: Obx(() => Text('Total: \$${c.total.value}'))),
            floatingActionButton: FloatingActionButton(
              onPressed: c.addBundle,
              child: const Text('+'),
            ),
          );
        },
      ),
    ],
  ),
);

Architectural Positioning & 4-Pillar Benchmark

Why SINT 2.0 is Not GetX (And Why Context-Free is Clean Architecture)

GetX was criticized for bundling unrelated utilities (GetConnect HTTP/sockets, string validators), using Type.toString() keys that broke under Web/Wasm minification, leaking conditional Obx listeners, and lacking batching or computed signals. SINT 2.0 replaces those internals with:

  1. Strict 4-Pillar Scope (S · I · N · T): Clean Architecture boundaries (domain, engine, router, ui) with zero unrelated utilities.
  2. Reified Type-Keyed DI & $O(M)$ Route Teardown: Safe under Web/Wasm minification; route-owned controllers and computed signals auto-dispose deterministically when their route exits.
  3. Zero-Stream Synchronous Signals: StreamController is allocated lazily only if .stream/.listen is called; Obx, Computed, Sint.batch, and everSync run on synchronous pointer lists.
  4. Why Context-Free APIs (Sint.toNamed, Sint.find, .tr) Are Safe by Design: In Flutter, navigation, snackbars, and localization belong to the root application host (NavigatorState / ScaffoldMessengerState), not to leaf widgets. Threading BuildContext into controllers or async callbacks couples domain logic to the UI tree and triggers use_build_context_synchronously bugs after await gaps. SINT binds lifecycle ownership directly to route entries in SintRoot, eliminating BuildContext plumbing without leaking state.

Solving the 4 Pillars: Development Velocity, Maintenance & Audit Savings

Building an equivalent 4-pillar feature (Reactive State + Derived Value + Scoped DI + Parameterized Route + i18n + Snackbar):

Dimension SINT 2.0 BLoC Stack (bloc + get_it + go_router + intl) Riverpod Stack (riverpod + go_router + intl) Provider Stack (provider + go_router + intl) Legacy GetX
Packages to Maintain & Audit 1 (sint) 5+ external packages 4+ packages + build_runner 4+ external packages 1 (bloated with HTTP/utils)
Files Touched per Feature 1–2 files 5–6 files (event, state, bloc, locator, router, .arb) 4–5 files (provider, .g.dart, router, .arb) 4 files (notifier, MultiProvider, router, .arb) 1–2 files
Codegen (build_runner) 0 generated files Optional (freezed/injectable) + ARB Required (.g.dart + ARB) ARB codegen 0 generated files
Feature Boilerplate (LoC) ~35 LoC ~165 LoC (4.7× more code) ~115 LoC (3.3× more code + .g.dart) ~105 LoC (3.0× more code) ~40 LoC (no batch/computed)
Code Audit & PR Review Surface Minimal (~70–80% less code to audit) High (events, copyWith, manual DI teardown, 5 dep trees) Medium–High (generated .g.dart + WidgetRef plumbing) Medium (manual notifyListeners + context wiring) High (global leaks, string keys)
State Granularity (S) Fine-grained Signals (Obx $O(1)$, batch, computed, untrack) Async Stream + immutable copyWith Provider graph (ConsumerWidget) Coarse object (ChangeNotifier) Unbatched .obs (stale branch leaks)
DI ↔ Router Lifecycle (I ↔ N) Native ($O(M)$ auto-dispose on route pop) Manual BlocProvider / GetIt scopes Coupled to widget unmount (autoDispose) Coupled to BuildContext subtree $O(N \times M)$ scan / string-key collisions
Route Matching (N) Multi-Level Prefix Trie ($O(\text{depth})$) External (go_router) External (go_router) External (go_router) Linear / 1st-segment regex scan
Flutter 3.47+ Standalone UI Native (SintApp) Manual host setup Manual host setup Manual host setup Unsupported (#3469)

Engineering & Audit Time Impact: Consolidating S · I · N · T into a single deterministic contract reduces per-feature code volume by 70%–78%, eliminates build_runner wait times, and cuts PR review & security audit time by ~3×–4×—auditors verify 1 cohesive ~35 LoC file with automatic route-bound teardown (onClose) and 1 dependency tree, instead of tracing state mutations, manual disposal, and version compatibility across 5–6 files and 5 third-party packages.

Verified 4-Pillar Benchmarks (four_pillars_benchmark_test.dart)

How is Sint.batch faster than both unbatched Rx and ChangeNotifier / BLoC?

  1. Inside SINT (0.23 µs batched vs 0.37 µs unbatched — 1.6× faster): Mutating 4 fields (items, price, tax, discount) without Sint.batch immediately recomputes derived state (total) and invokes downstream Obx listeners 4 separate times. Inside Sint.batch, each mutation sets a zero-allocation boolean flag (_queuedInBatch = true, ~1ns) and defers evaluation until the block exits—recomputing total 1 single time and notifying Obx 1 single time (75% less work).
  2. Against ChangeNotifier (0.90 µs) & BLoC (1.02 µs) — 4.0× to 4.5× faster: On a 20-widget screen where only 1 widget reads total, coarse model/stream patterns notify all 20 widgets on every mutation ($4 \times 20 = \mathbf{80\text{ widget callbacks}}$). SINT's fine-grained per-signal Obx graph notifies the 19 unrelated widgets 0 times and the 1 target widget 1 time ($\mathbf{1\text{ callback vs }80}$).
Workload SINT 2.0 Median Baseline / Alternative Median Result
Pillar S — 20-Widget Screen, 4-Field Transaction + Derived Total 0.23 µs/op (Sint.batch + Computed) 0.37 µs/op (Unbatched Rx)
0.90 µs/op (ChangeNotifier)
1.02 µs/op (Immutable State Copy)
1.6× faster than unbatched Rx
4.0× – 4.5× faster than ChangeNotifier / BLoC
Pillar N — 1,000 Shared-Prefix Routes (/api/item999/:id) 2.56 µs/op (Multi-Level Trie) 250.48 µs/op (1st-segment / linear regex scan) 97.8× faster ($O(\text{depth})$ constant scaling)
Pillar I — Hot Typed/Tagged Dependency Lookup (Sint.find<T>) 0.021 µs/op (Reified Type registry) — ~47M lookups/sec (Web/Wasm minification-safe)
Full S·I·N·T Cycle (Route Match + Sint.find + batch/computed + .trParams) 3.57 µs/op — ~280,000 complete 4-pillar cycles/sec

Migrating from GetX

  1. Replace get: with sint: ^2.2.1 in pubspec.yaml.
  2. Replace import 'package:get/get.dart'; with import 'package:sint/sint.dart';.
  3. Zero-friction compatibility in 2.x: Existing Get., GetxController, GetMaterialApp, GetPage, GetBuilder, and GetRouterOutlet calls continue to compile with @Deprecated notices so you can migrate to Sint* symbols incrementally before 3.0.0.

Documentation & Resources


Supporting SINT

SINT is MIT-licensed and battle-tested in production across the Open Neom modular ecosystem (30+ Clean Architecture packages powering live apps including EMXI, Gigmeout, Cyberneom, and Itzli).

If SINT saves engineering time for you or your team, consider supporting ongoing development through GitHub Sponsors:

  • Supporters help keep sint zero-bloat, benchmarked, and aligned with upcoming Flutter releases.
  • Organization Sponsors receive priority issue triage and logo placement in this README.

License

Released under the MIT License. Part of the Open Neom ecosystem.

Libraries

core/sint_core
core/src/domain/enums/smart_management
core/src/domain/errors/bind_error
core/src/domain/errors/obx_error
core/src/domain/extensions/sint_reset
core/src/domain/interfaces/sint_interface
core/src/domain/models/rx_bool
core/src/domain/models/rx_computed
core/src/domain/models/rx_custom
core/src/domain/models/rx_impl
core/src/domain/models/rx_interface
core/src/domain/models/rx_list
core/src/domain/models/rx_map
core/src/domain/models/rx_num
core/src/domain/models/rx_set
core/src/domain/models/rx_string
core/src/domain/typedefs/core_typedefs
core/src/domain/typedefs/legacy_typedefs
core/src/sint_engine
core/src/sint_main
core/src/sint_queue
core/src/utils/log
core/src/utils/testing/wrapper
core/src/utils/testing/wrapper_named
core/src/utils/testing/wrapper_translations
injection/sint_injection
injection/src/bind
injection/src/domain/extensions/injection_extension
injection/src/domain/interfaces/binding
injection/src/domain/interfaces/bindings_interface
injection/src/domain/models/binds
injection/src/domain/models/instance_info
injection/src/domain/models/route_dependency
injection/src/domain/typedefs/injection_typedefs
injection/src/lifecycle
injection/src/sint_service
injection/src/ui/bind_element
injection/src/ui/binder
injection/src/ui/multi_binder
injection/src/ui/sint_scope
navigation/sint_navigation
navigation/src/domain/enums/pop_mode
navigation/src/domain/enums/prevent_duplicate_handling_mode
navigation/src/domain/enums/row_style
navigation/src/domain/enums/snack_hover_state
navigation/src/domain/enums/snackbar_position
navigation/src/domain/enums/snackbar_status
navigation/src/domain/enums/snackbar_style
navigation/src/domain/enums/transition
navigation/src/domain/extensions/bottomsheet_extension
navigation/src/domain/extensions/context_extensions
navigation/src/domain/extensions/dialog_extension
navigation/src/domain/extensions/event_loop_extension
navigation/src/domain/extensions/first_where_extension
navigation/src/domain/extensions/overlay_extension
navigation/src/domain/extensions/page_arg_extension
navigation/src/domain/extensions/snackbar_extension
navigation/src/domain/interfaces/custom_transition
navigation/src/domain/interfaces/sint_middleware
navigation/src/domain/mixins/sint_navigation_mixin
navigation/src/domain/mixins/sint_transition_mixin
navigation/src/domain/models/config_data
navigation/src/domain/models/path_decoded
navigation/src/domain/models/route_data
navigation/src/domain/models/routing
navigation/src/domain/models/sint_route
navigation/src/domain/models/sint_snackbar_style
navigation/src/router/circular_reveal_clipper
navigation/src/router/index
navigation/src/router/middleware_runner
navigation/src/router/page_redirect
navigation/src/router/page_settings
navigation/src/router/route_decoder
navigation/src/router/route_parser
navigation/src/router/route_template
navigation/src/router/router_report_manager
navigation/src/router/sint_delegate
navigation/src/router/sint_information_parser
navigation/src/router/sint_navigator
navigation/src/router/sint_page
navigation/src/router/sint_page_route
navigation/src/router/sint_test_mode
navigation/src/router/url_strategy/impl/io_url
navigation/src/router/url_strategy/impl/stub_url
navigation/src/router/url_strategy/impl/web_url
navigation/src/router/url_strategy/url_strategy
navigation/src/sint_navigation_observer
navigation/src/ui/dialog/dialog_route
navigation/src/ui/sint_app
navigation/src/ui/sint_cupertino_app
navigation/src/ui/sint_material_app
navigation/src/ui/sint_root
navigation/src/ui/snackbar/snackbar
navigation/src/ui/snackbar/snackbar_controller
navigation/src/ui/snackbar/snackbar_queue
navigation/src/ui/transitions/circular_reveal_transition
navigation/src/ui/transitions/fade_in_transition
navigation/src/ui/transitions/left_to_right_fade_transition
navigation/src/ui/transitions/no_transition
navigation/src/ui/transitions/right_to_left_fade_transition
navigation/src/ui/transitions/size_transitions
navigation/src/ui/transitions/slide_down_transition
navigation/src/ui/transitions/slide_left_transition
navigation/src/ui/transitions/slide_right_transition
navigation/src/ui/transitions/slide_top_transition
navigation/src/ui/transitions/zoom_in_transition
navigation/src/ui/widgets/directionality_drag_gesture_recognizer
navigation/src/ui/widgets/sint_app_bar
navigation/src/ui/widgets/sint_back_gesture_controller
navigation/src/ui/widgets/sint_back_gesture_detector
navigation/src/ui/widgets/sint_router_outlet
rx
Headless reactive primitives (Rx, Rxn, RxString, RxBool, RxInt, RxDouble, RxList, RxMap, RxSet, .obs) without SINT UI navigation.
sint
SINT Framework
state_manager/sint_state_manager
state_manager/src/domain/mixins/equality_mixin
state_manager/src/domain/mixins/rx_ticket_provider_mixin
state_manager/src/domain/notify_data
state_manager/src/domain/rx_future
state_manager/src/domain/sint_status
state_manager/src/domain/typedefs/state_typedefs
state_manager/src/engine/get_builder
Legacy file preserved for backwards compatibility. Prefer importing package:sint/state_manager/src/engine/sint_builder.dart.
state_manager/src/engine/list_notifier
state_manager/src/engine/notifier
state_manager/src/engine/sint_builder
state_manager/src/engine/sint_controller
state_manager/src/sint_listenable
state_manager/src/ui/obx_reactive_element
state_manager/src/ui/obx_widget
state_manager/src/ui/sint_listener
state_manager/src/ui/sint_view
translation/sint_translation
translation/src/domain/extensions/locale_extension
translation/src/domain/extensions/trans_extension
translation/src/domain/interfaces/translations
translation/src/domain/models/intl_host
translation/src/domain/models/path_translator
translation/src/utils/translations_constants