Base Response

The API response structure should be consistent and easy to understand. It should include a status code, message, and the actual data being returned.
{
    "status_code": 200,
    "success": true,
    "message": "Login Success",
    "data": { // <-- login_response
        "token": "dcc36aa219448f4825673dfaeca75514dff81c0570ff9c66390d697d0a089aa3",
        "user": {
            "id": 1,
            "name": "Aghiad Odeh",
            "avatar": "https://images.pexels.com/photos/1043474/pexels-photo-1043474.jpeg?auto=compress&cs=tinysrgb&dpr=1&w=500",
            "country": "Greece",
            "city": "Sanford",
            "company": "Bespoke Plastic Table",
            "createdAt": "2022-06-13T15:03:24.653Z"
        }
    }
}
so the http request should receive “BaseResponse<T>” (Example with retrofit):
@RestApi()
abstract class AuthRestClient {
  factory AuthRestClient(Dio dio) = _AuthRestClient;

  @POST("/auth/login")
  Future<BaseResponse<LoginResponse>> login({
    @Body() required Map<String, dynamic> data
  });
}