MockResponseMixin<BodyType> mixin base

Response mixin for the purposes of creating mocks using a mocking framework such as Mockito or Mocktail.

base class MockResponse<BodyType> extends Mock with MockResponseMixin<BodyType> {}
Implemented types
  1. @visibleForTesting

Properties

base → BaseResponse
The http.BaseResponse from package:http that this Response wraps.
finalinherited
body → BodyType?
The body of the response after conversion by Chopper See Converter for more on body conversion.
finalinherited
bodyBytes Uint8List
Returns the response body as bytes (Uint8List) provided the network call was successful, else this will be null.
no setterinherited
bodyOrThrow → BodyType
Returns the response body if Response isSuccessful and body is not null. Otherwise it throws an HttpException with the response status code and error object. If the error object is an Exception, it will be thrown instead.
no setterinherited
bodyString String
Returns the response body as a String provided the network call was successful, else this will be null.
no setterinherited
error Object?
The body of the response if isSuccessful is false.
finalinherited
hashCode int
The hash code for this object.
no setterinherited
headers Map<String, String>
HTTP headers of the response.
no setterinherited
isSuccessful bool
Whether the network call was successful or not.
no setterinherited
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
statusCode int
The HTTP status code of the response.
no setterinherited
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited

Methods

copyWith<NewBodyType>({BaseResponse? base, NewBodyType? body, Object? bodyError}) Response<NewBodyType>
Makes a copy of this Response, replacing original values with the given ones. This method can also alter the type of the response body.
inherited
errorWhereType<ErrorType>() → ErrorType?
Check if the response is an error and if the error is of type ErrorType and casts the error to ErrorType. Otherwise it returns null.
inherited
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