ApiKit class

Standardized API result handling using result_controller. This replaces the old ApiResponse pattern with proper Ok/Err semantics.

Constructors

ApiKit()

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

Static Methods

badRequest<T>(String message, {Map<String, String>? validations}) ApiResult<T>
Creates a bad request error result.
conflict<T>(String message) ApiResult<T>
Creates a conflict error result.
err<T>({required String title, String? message, Object? exception, StackTrace? stackTrace, Map<String, String>? validations}) ApiResult<T>
Creates an error result with details.
forbidden<T>([String? message]) ApiResult<T>
Creates a forbidden error result.
notFound<T>([String? message]) ApiResult<T>
Creates a not found error result.
ok<T>(T data) ApiResult<T>
Creates a success result with data.
serverError<T>(String message, {Object? exception, StackTrace? stackTrace}) ApiResult<T>
Creates an internal server error result.
unauthorized<T>([String? message]) ApiResult<T>
Creates an unauthorized error result.