isJSONPrimitive function

bool isJSONPrimitive(
  1. Object? value
)

Returns true if value is a JSON primitive (String, bool, num, int, double, or null).

Implementation

bool isJSONPrimitive(Object? value) {
  return value == null || value is String || value is num || value is bool;
}