pulsar 0.0.4
pulsar: ^0.0.4 copied to clipboard
Flutter dependency injection and Navigator 2 routing: modular binds, route guards, async binds, RouterOutlet, and transitions.
Pulsar Package #
Pulsar is a smart project structure designed for Flutter applications, providing dependency injection and route management. This package aims to streamline the development process by offering a modular architecture that enhances code organization and reusability.
Features #
- Dependency Injection: Easily manage dependencies using the
Pulsarclass, allowing for better separation of concerns and testability. - Route Management: Simplify navigation within your app with a clear and concise routing system.
- Lightweight State Management: Utilize
ValueNotifierfor simple state management scenarios, and leverageBlocfor more complex state management needs. - Error Handling: Implement robust error handling strategies to improve user experience and application stability.
Testing #
- Unit tests under
test/use mocks for fast, isolated checks (e.g.PulsarRouterDelegatewith a fake parser). - Integration tests under
test/integration/wire realPulsarModuleservices (TrackerImpl,RouteServiceImpl,PulsarRouteInformationParser,PulsarRouterDelegate) so bugs between those layers are caught. Run withflutter test.
The example/ app also has widget tests that drive the full UI stack.
Example app #
The example/ folder is a runnable Flutter app (pulsar_example) that exercises DI, ModuleRoute, guards, RouterOutlet, AsyncBind, WildcardRoute, transitions, and WidgetModule. Run it with cd example && flutter run.
Getting Started #
Add pulsar to your pubspec.yaml:
dependencies:
pulsar: ^0.0.4
Wrap your app with PulsarApp and use MaterialApp.router with Pulsar.routeInformationParser and Pulsar.routerDelegate:
import 'package:flutter/material.dart';
import 'package:pulsar/pulsar.dart';
void main() {
runApp(
PulsarApp(
module: YourAppModule(),
child: MaterialApp.router(
routeInformationParser: Pulsar.routeInformationParser,
routerDelegate: Pulsar.routerDelegate,
),
),
);
}
See the full example/ app for modules, routes, guards, and NavigationListener.