magicLength method
Returns the length of the value if it is iterable or a map.
defaultValue: The value to return if the length cannot be determined or the value isnull.
Implementation
int magicLength({int defaultValue = 0}) {
if (this is Iterable) return (this as Iterable).length;
if (this is Map) return (this as Map).length;
return defaultValue;
}