readAsJson<T extends dynamic> method

Future<T> readAsJson<T extends dynamic>({
  1. T constructor(
    1. Map<String, dynamic> payload
    )?,
})

Implementation

Future<T> readAsJson<T extends dynamic>(
    {T Function(Map<String, dynamic> payload)? constructor}) async {
  final content = await readAsString();
  final Map<String, dynamic> map = jsonDecode(content);

  return constructor != null ? constructor(map) : map;
}