MeiliSearchApiException.fromHttpBody constructor
MeiliSearchApiException.fromHttpBody(
- String message,
- Object? httpBody
)
Implementation
factory MeiliSearchApiException.fromHttpBody(
String message,
Object? httpBody,
) {
if (httpBody != null &&
httpBody is Map<String, Object?> &&
httpBody.containsKey('message') &&
httpBody.containsKey('code') &&
httpBody.containsKey('link') &&
httpBody.containsKey('type')) {
return MeiliSearchApiException(
httpBody['message'] as String? ?? "",
code: httpBody['code'] as String?,
link: httpBody['link'] as String?,
type: httpBody['type'] as String?,
);
} else {
return MeiliSearchApiException(message);
}
}