json method

Future json()

Implementation

Future<dynamic> json() async {
  final content = await text();

  if (content.isEmpty) return null;

  try {
    return jsonDecode(content);
  } catch (e) {
    throw FormatException('Invalid JSON body: $e');
  }
}