isValuePrimitive function
Returns true when value is a primitive value or a collection of primitives.
Primitive values include num, bool, String, BigInt, and DateTime.
Iterables and maps are considered primitive when all elements are primitive.
Example:
final ok = isValuePrimitive(10); // true
final nope = isValuePrimitive(Object()); // false
Implementation
bool isValuePrimitive(dynamic value) => value is Object && value.isPrimitive();