ok_route 0.1.4

  • Readme
  • Changelog
  • Installing
  • 46

ok_route #

Annotation route of flutter.

Usage #

import project #

  ok_route_library: ^0.1.1

Add Annotation to your widget #

import 'package:ok_route_library/ok_route_library.dart';

class HomePage extends StatelessWidget{
    // ...

Generate route class #

How to use pub global

Use pub global

Add pub/pub.bat to your $PATH.

Add cache/bin to your path like image


Get generator

$ pub global activate ok_route


$ pub.bat global activate ok_route

Use generator

$ ok_route $your_project

Use route in your project #

import 'package:ok_route_example/okroutes.dart'; // The dart file have the routes.

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      home: MyHomePage(title: 'Flutter Demo Home Page'),
      onGenerateRoute: OKRouteMap.onGenerateRoute, // routes create by ok_route.

Pass params #

Push #

Only support basic type, because it will be converted to json during the transfer process.

import 'package:ok_route_library/ok_route_library.dart';

  final name = OKRoute.createPushString(
    params: {"name": "hello"},

// or

  OKRoute.pushNamed(context, "/sub_home", params: {"name": "hello"},);

Get #

import 'package:ok_route_library/ok_route_library.dart';

class Page extends StatelessWidget {
  Widget build(BuildContext context) {
    final name = OKRoute.getParams(context)["name"]; // Get params , the params type is Map<String,dynamic>.
    return Scaffold(
      appBar: AppBar(
        title: Text("title"),
      body: Container(
        child: Column(
          children: <Widget>[


MIT style

0.1.3 #

  • The library is tools.
  • Split a flutter library for flutter.

0.1.2 #

Fix bug.

Support pass param.

0.1.1 #

Update project structure.

0.1.0 #

  • Initial version, created by Caijinglong

Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate ok_route

2. Use it

The package has the following executables:

$ ok_route

Use this package as a library

1. Depend on it

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

  ok_route: ^0.1.4

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or 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:ok_route/ok_route.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 Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.9+1

Health issues and suggestions

Document public APIs. (-1 points)

44 out of 44 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix bin/main.dart. (-1 points)

Analysis of bin/main.dart reported 2 hints:

line 3 col 8: Unused import: 'package:ok_route/ok_route.dart'.

line 8 col 7: Use isEmpty instead of length

Fix lib/src/code_maker.dart. (-0.50 points)

Analysis of lib/src/code_maker.dart reported 1 hint:

line 3 col 8: Unused import: 'package:ok_route/ok_route.dart'.

Format lib/generator.dart.

Run dartfmt to format lib/generator.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and ok_route.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

The package description is too short. (-5 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
yaml ^2.1.16 2.2.1
Transitive dependencies
charcode 1.1.3
collection 1.14.13
meta 1.1.8 1.2.0
path 1.7.0
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
Dev dependencies
test ^1.0.0