swiss_knife 2.2.1

  • Readme
  • Changelog
  • Installing
  • 68

Swiss Knife #

Dart useful tools: collections, math, date, etc...

Usage #

A simple usage example:

import 'package:swiss_knife/swiss_knife.dart';

class User {

  final EventStream<String> onNotification = new EventStream() ;

  void notify(String msg) {
    onNotification.add(msg) ;
  }

}

void main() {

  User user = new User() ;

  user.onNotification.listen((msg) {
    print("NOTIFICATION> $msg") ;
  });

}

Features and bugs #

Please file feature requests and bugs at the issue tracker.

Author #

Graciliano M. Passos: gmpassos@GitHub.

License #

Dart free & open-source license.

2.2.1 #

  • Organize code in different dart files.
  • Code analysis.
  • Upgrade dependencies:
    • intl: ^0.16.1
    • remove "enum_to_string".

2.2.0 #

  • Remove locales to package intl_messages.
  • Remove rest_client to package mercury_client.

2.1.2 #

  • Add LocalesManager.onDefineLocale and LocalesManager.onDefineLocaleGlobal

2.1.1 #

  • Small fixes.

2.1.0 #

  • Added Authorization and Credential/Token handling to REST Client.

2.0.0 #

  • Update to Dart 2.0.1 and small fixes. Now able to import only utils (swiss_knife_utils.dart)

1.0.1 #

  • Fix swiss_knife_browser.dart exports.

1.0.0 #

  • Added events example.
  • Initial version, created by Stagehand

Use this package as a library

1. Depend on it

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


dependencies:
  swiss_knife: ^2.2.1

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:swiss_knife/swiss_knife.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
49
Health:
Code health derived from static analysis. [more]
86
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
68
Learn more about scoring.

We analyzed this package on Jan 27, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.4

Health suggestions

Fix lib/src/date.dart. (-5.36 points)

Analysis of lib/src/date.dart reported 11 hints, including:

line 6 col 10: Unnecessary new keyword.

line 15 col 35: Unnecessary new keyword.

line 20 col 35: Unnecessary new keyword.

line 36 col 14: Unnecessary new keyword.

line 37 col 20: Unnecessary new keyword.

Fix lib/src/utils_browser.dart. (-3.93 points)

Analysis of lib/src/utils_browser.dart reported 8 hints, including:

line 8 col 13: Unnecessary new keyword.

line 35 col 30: Unnecessary new keyword.

line 44 col 46: Unnecessary new keyword.

line 70 col 3: Unnecessary new keyword.

line 70 col 23: Unnecessary new keyword.

Fix lib/src/collections.dart. (-3.45 points)

Analysis of lib/src/collections.dart reported 7 hints, including:

line 30 col 12: Unnecessary new keyword.

line 31 col 12: Unnecessary new keyword.

line 74 col 10: Unnecessary new keyword.

line 79 col 10: Unnecessary new keyword.

line 84 col 10: Unnecessary new keyword.

Fix additional 5 files with analysis or formatting issues. (-2.49 points)

Additional issues in the following files:

  • lib/src/utils.dart (3 hints)
  • lib/src/events.dart (2 hints)
  • lib/src/math.dart (Run dartfmt to format lib/src/math.dart.)
  • lib/swiss_knife.dart (Run dartfmt to format lib/swiss_knife.dart.)
  • lib/swiss_knife_browser.dart (Run dartfmt to format lib/swiss_knife_browser.dart.)

Maintenance suggestions

The package description is too short. (-10 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.

Maintain an example.

None of the files in the package's example/ directory matches known example patterns.

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

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.2.0 <3.0.0
intl ^0.16.1 0.16.1
Transitive dependencies
path 1.6.4
Dev dependencies
test ^1.5.1