DebangImpl<T> class

A custom error type that provides additional context (such as method, file, line, filtered stack trace) and notifies observers when it is created.

This class is useful when you want to enrich exceptions with more details about their origin, while also giving external code the ability to listen to and react to errors.

Usage:

throw Debang('Unexpected null value');
Implemented types
Mixed-in types

Constructors

DebangImpl(String assertion, [StackTrace? st])
Creates a new DebangImpl error with the given assertion description and an optional original StackTrace.

Properties

assertion → String
The developer's assertion (guarantee) describing why this value was assumed to be non-null at the point of failure.
final
expectedType → String
The generic type T that was expected to be present but turned out to be null.
no setter
frame ↔ StackFrameInfo?
Utility class used to extract and filter stack trace information.
latefinal
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
stackTrace ↔ StackTrace?
The original StackTrace captured at the moment of error creation.
latefinal

Methods

firstRelevantFrame(StackTrace? stackTrace) → StackFrameInfo?
Returns the first relevant frame (method, file, line, column) from stackTrace, skipping debang and dart:runtime frames.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyObservers() → void
Called when a new Debang error is created.
toString() → String
A string representation of this object.
override

Operators

operator ==(Object other) → bool
The equality operator.
inherited