errors 0.1.1

errors #

Errors keeps a registry of all possible exceptions which could be encountered.

Many times several exceptions can occur, some common and some less common.

In order to handle these gracefully we will often want to react differently according to the nature of the error.

e.g. code might fail due to a http error and within the same block a disk could be full or even a legitimate user error could be thrown.

Quick example:

  Errors errors;
  SomeExceptionHandler someExceptionHandler = SomeExceptionHandler();
  AnotherExceptionHandler anotherExceptionHandler = AnotherExceptionHandler();
  final errors = Errors()
  // Instead of using try/catch blocks the exceptions are now 
  // automatically catched and the registered exception handlers will
  // handle the exceptions.
    () {
      throw SomeException();

    () {
      throw AnotherException();

[0.1.1] - 10.08.2019

  • Check error by name instead of type to cover edge cases.

[0.1.0] - 10.08.2019

  • Rethrow unhandled exceptions

[0.0.1] - 05.08.2019

  • Initial release

Use this package as a library

1. Depend on it

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

  errors: ^0.1.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:errors/errors.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 Feb 13, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Maintenance suggestions

The package description is too short. (-20 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. (-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 errors.dart. Packages with multiple examples should provide example/

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev<3.0.0
Dev dependencies
test any