Skip to content
pubscout

get_it_mixin

4.2.2, released 3 years ago by an unverified publisher

Mixin that lets widgets watch GetIt‑registered objects and rebuild on changes.

WASM-ready
$ flutter pub add get_it_mixin
Source repository

What it does

Provides GetItMixin and related mixins to read and watch ChangeNotifier, ValueNotifier, Stream or Future instances stored in GetIt. It automatically manages subscriptions and rebuilds the widget when the data changes.

AI-written summary of version 4.2.2, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You already use GetIt for dependency injection and want UI to react to changes without manual StreamBuilder or ValueListenableBuilder
  • You need a lightweight way to bind widget rebuilds to simple listenable objects

Skip it when

  • You need a full‑featured state‑management solution like Bloc or Riverpod
  • You require code‑generation or advanced features not offered by this mixin

Strengths

  • Very little boilerplate compared to manual builders
  • Works directly with existing GetIt registrations
  • No extra code‑generation steps

Weaknesses

  • Package is no longer maintained
  • Strict ordering rules for watch calls can be error‑prone
  • Limited to GetIt‑based data sources

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
2
class UserNameText extends StatelessWidget with GetItMixin {
  @override
  Widget build(BuildContext context) {
    final userName = watchOnly((UserModel m) => m.name);
    return Text(userName);
  }
}

Works with

Packages commonly used together with get_it_mixin: ones it builds on, ones built on it, and its own family.