routing_config_provider 1.0.0 copy "routing_config_provider: ^1.0.0" to clipboard
routing_config_provider: ^1.0.0 copied to clipboard

A Flutter package project that gives the option to have a separate home page for web and mobile

routing_config_provider #

The RoutingConfigProvider class gives the option to have a separate Go_Router routing config for web and mobile

Getting started #

Installation #

In the dependencies: section of your pubspec.yaml, add the following line:

dependencies:
  home_page_provider: ^1.0.0

Than import the package via:

import 'package:routing_config_provider/routing_config_provider.dart';

Usage #

Instead of passing your home page widget to, for example, MaterialApp, you would pass 2 versions of it instead, one for web and one for mobile.

@override
  Widget build(BuildContext context) {
  
    ...
  
      final rc = RoutingConfigProvider().getWebOrMobileRoutingConfig(
        webRoutingConfig,
        mobileRoutingConfig,
      );
  
    ...

    return MaterialApp(
      title: 'Routing Config Provider package demo',
      home: MaterialApp.router(
        routerConfig: router,
        debugShowCheckedModeBanner: false,
        title: 'Routing Config Provider package demo',
      ),
    );
    
    ...
  
  }

Additional information #

This package relies on the idea that the following imports are mutually exclusive:

  import 'package:go_router/go_router.dart';
  import 'routing_config_provider_locator.dart'
  if (dart.library.io) 'routing_config_provider_mobile.dart'
  if (dart.library.html) 'routingconfig_provider_web.dart';

Take a look at the package source.

0
likes
130
pub points
24%
popularity

Publisher

unverified uploader

A Flutter package project that gives the option to have a separate home page for web and mobile

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, go_router

More

Packages that depend on routing_config_provider