readAsJsonSync<T extends dynamic> method

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

Implementation

T readAsJsonSync<T extends dynamic>(
    {T Function(Map<String, dynamic> payload)? constructor}) {
  final content = readAsStringSync();
  final Map<String, dynamic> map = jsonDecode(content);

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