ApiResponse class
API response
Constructors
-
ApiResponse({required int statusCode, dynamic data, Map<
String, String> headers = const {}}) - ApiResponse.badRequest([String? message])
-
Bad request response (400)
factory
- ApiResponse.created([dynamic data])
-
Created response (201)
factory
- ApiResponse.error([String? message])
-
Internal server error response (500)
factory
- ApiResponse.forbidden([String? message])
-
Forbidden response (403)
factory
- ApiResponse.json(dynamic data, {int statusCode = 200})
-
Success response with JSON data
factory
- ApiResponse.methodNotAllowed()
-
Method not allowed response (405)
factory
- ApiResponse.noContent()
-
No content response (204)
factory
- ApiResponse.notFound([String? message])
-
Not found response (404)
factory
- ApiResponse.ok([dynamic data])
-
Success response
factory
- ApiResponse.redirect(String location, {bool permanent = false})
-
Redirect response
factory
-
Unauthorized response (401)
factory
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toJson(
) → String - Convert to JSON string
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited