exception_helper 1.0.4 copy "exception_helper: ^1.0.4" to clipboard
exception_helper: ^1.0.4 copied to clipboard

Exception Handler simplifies exception handling in Dart and Flutter applications. It offers a streamlined approach to managing exceptions with customizable error messages and flexible exception handling.

Exception Handler

LinkedIn Badge YouTube Badge Twitter Badge


Exception Handler #

Exception Handler is a Dart package that provides a simple and flexible way to handle exceptions in your Dart/Flutter applications. It allows users to specify which types of exceptions they want to handle and provides customizable error messages for different exception scenarios.

Features #

  • Handle exceptions easily with a single function call.
  • Specify which types of exceptions to handle.
  • Customize error messages for different exception scenarios.
  • Lightweight and easy to integrate into your projects.

Installation #

To use Exception Handler in your Dart/Flutter project, add the following line to your pubspec.yaml file:

dependencies:
  exception_handler: ^1.0.0

Then, run dart pub get to install the package.

Usage #

Import the package into your Dart file:

import 'package:exception_handler/exception_handler.dart';

Use the handleExceptions function to handle exceptions in your code:

void main() async {
  try {
    await ExceptionHelper.handle(
      () async {
        // Code that might cause exceptions
        await signinWithGoogle();
      },
      needFirebaseAuthException: true, // Specify which exceptions to handle
      needFirebaseException: false, // Specify other exceptions to handle
    );
  } catch (e) {
    // Handle the exceptions thrown by the handleExceptions function
    print('An exception occurred: $e');
  }
}

License #

This package is distributed under the GNU License. See the LICENSE file for more information.


4
likes
125
pub points
36%
popularity

Publisher

unverified uploader

Exception Handler simplifies exception handling in Dart and Flutter applications. It offers a streamlined approach to managing exceptions with customizable error messages and flexible exception handling.

Repository (GitHub)
View/report issues

Documentation

API reference

License

GPL-3.0 (license)

Dependencies

cloud_firestore, firebase_auth, firebase_core, firebase_storage, flutter

More

Packages that depend on exception_helper