compassion 0.1.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 55

Compass #

A simple shim to make named routes with arguments easier.

How to use #

If you don't want to access the routes at runtime

  • You only need to add Compass as the onGenerateRoute argument
class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MaterialApp(
      onGenerateRoute: Compass({
        "/": (c, a) => MyHomePage(title: a),

If you want to access the routes at runtime

  • If you only use named routes, use Compass.of(context).routes

  • If you use a mix of named and anonymous routes

    • Create your Compass in an accessible scope, for example, as a member of your master widget
    • Add a CompassProvider as a parent of your MaterialApp
    • Provide your Compass to the CompassProvider
    • Put your MaterialApp inside of the CompassProvider
    • Set the onGenerateRoute parameter to your Compass
    class MyApp extends StatelessWidget {
        final compass = Compass({
            "/": (c, a) => MyHomePage(title: a),
        Widget build(BuildContext context) {
            return CompassProvider(
                compass: compass,
                child: MaterialApp(
                    onGenerateRoute: compass,
                    home: MyHomePage(),

Features #

  • Accessible anywhere for modification
  • Simple interface

[0.1.0] - 2019/01/30

  • Initial release
  • Simplified interface
  • Routes are accessible anywhere

[0.1.1] - 2019/03/05

  • Removed warning about the compatibility


example #

A new Flutter project.

Getting Started #

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  compassion: ^0.1.1

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:compassion/compassion.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Oct 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/compassion.dart.

Run flutter format to format lib/compassion.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies