getValueAs<T> abstract method

T? getValueAs<T>([
  1. Object? instance
])

Gets the field's value with type safety.

Type Parameters:

  • T: The expected return type

Parameters:

  • instance: The object instance

Returns:

  • The field value cast to type T
  • null if value is null or type conversion fails

Example:

final name = field.getValueAs<String>(instance);

Implementation

T? getValueAs<T>([Object? instance]);