ScrellaApiBaseResponse<T>.fromJson2 constructor

ScrellaApiBaseResponse<T>.fromJson2(
  1. Map<String, dynamic>? json
)

Creates a ScrellaApiBaseResponse from a decoded JSON map.

Throws FormatException if:

  • json is null (empty body) – this is always an error.
  • status or message fields are missing or have the wrong type.
  • data is null for this factory.

Implementation

factory ScrellaApiBaseResponse.fromJson2(
  Map<String, dynamic>? json, // non‑nullable – null JSON is an error
) {
  final status = json?['status'] ?? false;
  final message = json?['message'] ?? "";

  return ScrellaApiBaseResponse(status: status, message: message, data: null);
}