ResponseModel class

A base class for all response models.

This class provides a common structure for all response models, including a status code, message, data, affected rows, extra data, and a list of required validation errors. It also provides methods to convert the response model to and from a JSON object, and a method to copy the response model.

All response models should inherit from this class and add any additional properties that they need.

Constructors

ResponseModel({int? statusCode, String? message, dynamic data, int? affectedRows, dynamic extra, List<ValidationErrorModel>? required})
Creates a new instance of ResponseModel.
ResponseModel.fromJson(Map<String, dynamic> json)
Creates a new instance of ResponseModel from a JSON object.

Properties

affectedRows int?
The number of rows affected by the request.
getter/setter pair
data ↔ dynamic
The main data of the response.
getter/setter pair
extra ↔ dynamic
Any extra data included in the response.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
message String?
The message of the response.
getter/setter pair
required List<ValidationErrorModel>?
A list of validation errors that were required for the request.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusCode int?
The status code of the response.
getter/setter pair

Methods

copyWith({int? statusCode, String? message, dynamic data, int? affectedRows, dynamic extra, List<ValidationErrorModel>? required}) → dynamic
Creates a copy of the ResponseModel with the specified values.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson() Map<String, dynamic>
Converts the ResponseModel to a JSON object.
toString() String
A string representation of this object.
inherited

Operators

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