getType method

Class? getType()

Returns the type of the held value.

If a qualified name is provided, it returns the class from the qualified name. Otherwise, it returns the class of the held value.

Example

final holder = ObjectHolder<int>(99, packageName: 'core');
print(holder.getType()); // int

Implementation

Class? getType() {
  if (_qualifiedName != null) {
    return Class.fromQualifiedName(_qualifiedName);
  }

  if (_value == null) {
    return null;
  }

  return _value.getClass(null, _packageName);
}