pulsar 0.0.4 copy "pulsar: ^0.0.4" to clipboard
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 Pulsar class, 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 ValueNotifier for simple state management scenarios, and leverage Bloc for 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. PulsarRouterDelegate with a fake parser).
  • Integration tests under test/integration/ wire real PulsarModule services (TrackerImpl, RouteServiceImpl, PulsarRouteInformationParser, PulsarRouterDelegate) so bugs between those layers are caught. Run with flutter 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.

1
likes
0
points
21
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter dependency injection and Navigator 2 routing: modular binds, route guards, async binds, RouterOutlet, and transitions.

Repository (GitHub)
View/report issues

Topics

#dependency-injection #navigation #routing #di

License

unknown (license)

Dependencies

characters, flutter, meta

More

Packages that depend on pulsar