instanceOfString function Null safety

bool instanceOfString(
  1. Object? element,
  2. String objectType
)

Like instanceof only takes a String for the object name instead of a constructor object.

Implementation

bool instanceOfString(Object? element, String objectType) {
  Object? constructor = _getConstructor(objectType);
  return constructor != null && instanceof(element, constructor);
}