AppResponse<T> class sealed

A sealed base class representing all possible outcomes from a Tuul AI API request.

Using a sealed class allows the Dart compiler to ensure that all response subtypes—SuccessResponse, ErrorResponse, and ActionResponse—are handled when pattern matching using a switch statement.

Example:

final response = await Gen.instance.run(tuulOptions: options);
switch (response) {
  case SuccessResponse(:final data):
    print('Success: $data');
  case ErrorResponse(:final error):
    print('Failure: $error');
  case ActionResponse(:final action):
    print('Action required: $action');
}
Implementers

Constructors

AppResponse.fromJson(Map<String, dynamic> json, {T dataParser(dynamic json)?})
Maps a raw JSON Map into the appropriate AppResponse subtype.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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