ApiResponse<T> class
Standard API response model.
Constructors
- ApiResponse.new({required bool success, T? data, String? error, String? message, int? statusCode})
-
const
- ApiResponse.badRequest(String error)
-
Creates a bad request response.
factory
- ApiResponse.error(String error, [int? statusCode])
-
Creates an error response.
factory
- ApiResponse.forbidden([String? message])
-
Creates a forbidden response.
factory
-
ApiResponse.fromJson(Map<
String, dynamic> json) -
Creates an ApiResponse from JSON.
factory
- ApiResponse.notFound([String? message])
-
Creates a not found response.
factory
- ApiResponse.success(T data, [String? message])
-
Creates a successful response.
factory
-
Creates an unauthorized response.
factory
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → String - Converts the response to JSON.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited