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.

example/lib/main.dart

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: const Text('pulsar_example'),
                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
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