toJson method

Map<String, dynamic> toJson()

Converts this ServiceError to a JSON representation.

Creates a map suitable for serialization containing the error message and numeric error code.

Returns a map with 'message' and 'code' fields.

Implementation

Map<String, dynamic> toJson() {
  return {'message': message, 'code': code.value};
}