flutter_getit
3.0.1, released 2 years ago by academiadoflutter.com.br
Manages Flutter project dependencies and routing using get_it.
What it does
Integrates with get_it to efficiently manage Flutter dependencies while providing robust page control, route management, and module flexibility. It automatically registers and removes dependencies as needed based on the app lifecycle and routing.
AI-written summary of version 3.0.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You are using get_it for dependency injection and want integrated module-based routing.
- You need automatic cleanup of dependencies when navigating away from pages or modules.
- You want to organize large Flutter applications into hierarchical modules with scoped bindings.
Skip it when
- you prefer state management solutions like Provider or Riverpod for dependency injection.
- You are using alternative routing frameworks like go_router or auto_route that handle their own scope management.
Strengths
- Automatic dependency cleanup upon leaving routes or modules.
- Flexible modular architecture with hierarchical binding support.
- Integrates directly with Flutter's native routing lifecycle.
Weaknesses
- Tied strictly to the get_it package ecosystem.
- Requires adopting a specific modular routing structure defined by the package.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
Wrap your MaterialApp with FlutterGetIt and supply modules or page routers.
import 'package:flutter/material.dart';
import 'package:flutter_getit/flutter_getit.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return FlutterGetIt(
modulesRouter: [
FlutterGetItModuleRouter(
name: '/Initialize',
pages:[
FlutterGetItPageRouter(
name: '/Landing',
builder: (context) => const Scaffold(
body: Center(
child: Text('Initializing...'),
),
),
),
]
),
],
builder: (context, routes, isReady) {
return MaterialApp(
title: 'Flutter Demo',
initialRoute: '/Landing/Initialize',
routes: routes,
builder: (context, child) => switch (isReady) {
true => child ?? const SizedBox.shrink(),
false => const WidgetLoadDependencies(),
},
);
},
);
},
);Alternatives
Packages that do the same job and could replace flutter_getit.
- auto_route
If you want a powerful declarative routing solution with code generation rather than building routes manually via flutter_getit.
87Compare - go_router
If you need an official declarative router with deep-linking support built directly on top of the Router API.
98Compare
Works with
Packages commonly used together with flutter_getit: ones it builds on, ones built on it, and its own family.