fromType static method

  1. @protected
String? fromType(
  1. dynamic type
)

Returns ReactClass.dartComponentVersion if type is the ReactClass for a Dart component (a react-dart ReactElement or ReactComponent), and null otherwise.

Implementation

@protected
static String? fromType(dynamic type) {
  // This check doesn't do much since ReactClass is an anonymous JS object,
  // but it lets us safely cast to ReactClass.
  if (type is ReactClass) {
    return type.dartComponentVersion;
  }
  if (type is Function) {
    return getProperty(type, 'dartComponentVersion') as String?;
  }

  return null;
}