pulsar 0.1.1 copy "pulsar: ^0.1.1" to clipboard
pulsar: ^0.1.1 copied to clipboard

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

example/lib/main.dart

/// Entry point for the **pulsar** package example published on pub.dev.
///
/// Wires [PulsarApp] + [MaterialApp.router] with [Pulsar.routeInformationParser]
/// and [Pulsar.routerDelegate]. See [AppModule] for modules, binds, and routes.
library;

import 'package:flutter/material.dart';
import 'package:pulsar/pulsar.dart';

import 'app/app_module.dart';

void main() {
  runApp(
    PulsarApp(
      module: AppModule(),
      child: const PulsarExampleApp(),
    ),
  );
}

class PulsarExampleApp extends StatelessWidget {
  const PulsarExampleApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp.router(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      routeInformationParser: Pulsar.routeInformationParser,
      routerDelegate: Pulsar.routerDelegate,
      builder: (context, child) {
        return NavigationListener(
          builder: (context, _) {
            return Scaffold(
              appBar: AppBar(
                title: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  mainAxisSize: MainAxisSize.min,
                  children: [
                    const Text('Pulsar example'),
                    Text(
                      'pub.dev demo · example/README.md',
                      style: Theme.of(context).textTheme.bodySmall,
                    ),
                  ],
                ),
                bottom: PreferredSize(
                  preferredSize: const Size.fromHeight(24),
                  child: Align(
                    alignment: Alignment.centerLeft,
                    child: Padding(
                      padding: const EdgeInsets.only(left: 16, bottom: 8),
                      child: Text(
                        'path: ${Pulsar.to.path}',
                        style: Theme.of(context).textTheme.bodySmall,
                      ),
                    ),
                  ),
                ),
              ),
              body: child,
            );
          },
        );
      },
    );
  }
}
1
likes
160
points
21
downloads

Documentation

API reference

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

MIT (license)

Dependencies

characters, flutter, meta

More

Packages that depend on pulsar