ServiceProviderUtils class

A utility class providing helper methods for handling HTTP responses, building JSON-RPC requests, and parsing responses in a service-oriented architecture.

Constructors

ServiceProviderUtils()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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

Static Methods

buildJsonRPCParams({required int requestId, required String method, Object? params}) Map<String, dynamic>
Builds a JSON-RPC request object.
ecodeResponse({required Object? body, required ServiceReponseEncoding encoding}) Object?
Parses a response string into a result of type T.
ecodeStringResponse({required String body, required ServiceReponseEncoding encoding}) Object?
Parses a response string into a result of type T.
encodeBytesResponse({required List<int> bytes, required ServiceReponseEncoding encoding}) Object?
Parses a response bytes into a result of type T.
findError({Object? object, required int statusCode, List<int>? allowStatusCode}) ServiceErrorResponse
Finds an error message from the response based on the status code and object type.
getDefaultError(int statusCode) String
isSuccessStatusCode(int statusCode, {List<int>? allowSuccessStatusCodes}) bool
Checks if the given HTTP status code indicates a successful response.
toResponse<T>({required Object? object, required BaseServiceRequestParams params}) → T
Parses a response object into a result of type T.