explorator 1.1.0 copy "explorator: ^1.1.0" to clipboard
explorator: ^1.1.0 copied to clipboard

A routing system which fits perfectly between catalyst_builder and the flutter router.

example/lib/main.dart

import 'package:catalyst_builder/catalyst_builder.dart';
import 'package:explorator/explorator.dart';
import 'package:flutter/material.dart';
import 'package:url_strategy/url_strategy.dart';

import 'main.catalyst_builder.g.dart';

@GenerateServiceProvider()
void main() {
  setPathUrlStrategy();

  // Create an instance of the service provider
  var provider = DefaultServiceProvider();
  provider
    // Extension method from the explorator package
    ..useExplorator(
      routeBuilder: MaterialRouteBuilder(),
    )
    ..boot();

  // Run the app
  runApp(MyApp(provider));
}

class MyApp extends StatelessWidget {
  /// Inject the provider
  final ServiceProvider _provider;

  const MyApp(this._provider, {super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      // Use the navigator key
      navigatorKey: _provider.resolve<GlobalKey<NavigatorState>>(),
      // Set the initial route.
      initialRoute: '/',
      // Use the RouteResolver for generating routes
      onGenerateRoute: _provider.resolve<RouteResolver>().resolveRoute,
    );
  }
}
2
likes
160
pub points
34%
popularity

Publisher

verified publishermintware.de

A routing system which fits perfectly between catalyst_builder and the flutter router.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

catalyst_builder, flutter, mockito

More

Packages that depend on explorator