jsonTypeOf function

String jsonTypeOf(
  1. Object? value
)

The JSON type of a decoded value. int and double stay apart, like {} and []: a client can tell them, and PHP's empty array is the classic drift.

Implementation

String jsonTypeOf(Object? value) => switch (value) {
  null => 'null',
  bool() => 'boolean',
  int() => 'integer',
  double() => 'double',
  String() => 'string',
  List<Object?>() => 'array',
  Map<Object?, Object?>() => 'object',
  _ => 'unknown',
};