pine
1.0.4, released 2 years ago by mylittlesuite.com
A lightweight architecture helper for Flutter projects using Provider and BLoC.
What it does
Provides a DependencyInjectorHelper widget to inject mappers, services, repositories, and global BLoCs down the widget tree in a structured layered architecture.
AI-written summary of version 1.0.4, based on the package's README and metadata. Report an inaccuracy
Use it when
- You want a structured layered architecture using Provider and BLoC.
- You want to organize global dependencies like mappers, services, and repositories cleanly.
Skip it when
- You are not using Provider or Flutter BLoC in your project.
- You prefer a different state management library like Riverpod.
Strengths
- Simplifies wiring up layered architectures with BLoC and Provider.
- Makes testing easier by allowing mock dependency injection via DependencyInjectorHelper.
Weaknesses
- Tight coupling to Provider and Flutter BLoC.
- Limited feature set beyond basic dependency organization.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 2
Not documented
class App extends StatelessWidget {
const App({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) => DependencyInjectorHelper(
blocs: [
BlocProvider<NewsBloc>(
create: (context) => NewsBloc(
newsRepository: context.read(),
)..fetchNews(),
),
],
child: MaterialApp(
home: const HomePage(),
),
);
}Alternatives
Packages that do the same job and could replace pine.
- inject_annotation
Constructor-based compile-time dependency injection framework for Dart and Flutter.
76Compare - scoped_deps
A simple DI library using Dart Zones for scoped dependencies.
69Compare - cherrypick
Flexible and lightweight dependency injection library for Dart and Flutter.
69Compare - modular_core
Injection system and routes for flutter_modular and shelf_modular
67Compare
Works with
Packages commonly used together with pine: ones it builds on, ones built on it, and its own family.