style: very good analysis Powered by Mason License: MIT

A Flutter package for handling exceptions in a clean and simple way.


// Import the package
import 'package:excalibur/excalibur.dart';

// 1. Define your custom exceptions by extending the `BladeException` class
class CustomException implements BladeException {
    // The error code associated with the exception
    int get code => 1;
    // The message that will be displayed to the user
    String get message => 'Custom Exception Message';
    // Whether the error page replaces the current page or not
    bool get replace => false;

void main() {
    final _exceptions = [
        // 2. Register your custom exceptions
    // Initialize an instance of Excalibur
    final excalibur = Excalibur(
                        exceptions: _exceptions,
                        unknownException: UnknownNumberException(),
                        builder: (exception) => ErrorPage(exception: exception),
    // Inject the instance of Excalibur into your app or call it directly
    excalibur.handleException(e as BladeException); // e is the exception

    // 3. Throw your custom exceptions
    throw CustomException();
    // or


View Github