json method
dynamic
json()
Parses the request body as JSON.
Returns null if the decoded body text is empty or whitespace-only.
Throws FormatException if the body is not valid JSON.
Throws StateError if this request is a streaming request.
Example
final data = request.json() as Map<String, dynamic>?;
Implementation
dynamic json() {
final str = text();
if (str.trim().isEmpty) return null;
return jsonDecode(str);
}