TypeInfo<T>.from constructor

TypeInfo<T>.from(
  1. Object o, [
  2. Iterable<Object>? arguments,
  3. Object? object
])

Implementation

factory TypeInfo.from(Object o,
    [Iterable<Object>? arguments, Object? object]) {
  if (o is TypeInfo) return o as TypeInfo<T>;
  if (o is Type) return TypeInfo<T>.fromType(o, arguments, object);

  if (o is ParameterReflection) {
    return o.type.typeInfo as TypeInfo<T>;
  }

  if (o is TypeReflection) {
    return o.typeInfo as TypeInfo<T>;
  }

  if (o is T) {
    return TypeInfo<T>.fromObject(o as T, arguments, object);
  } else {
    return TypeInfo<T>.fromType(o.runtimeType, arguments, object ?? o);
  }
}