parseValue<T> static method

T parseValue<T>(
  1. dynamic input
)

Attempts to parse the given input into the type T. This currently supports the following types:

  • bool
  • String
  • double
  • int
  • num
  • DateTime
  • Duration

Any other type will result in an exception.

Implementation

static T parseValue<T>(dynamic input) {
  final result = maybeParseValue<T>(input);

  if (result == null) {
    throw Exception(
      'Non-nullable parseValue was called but null was encountered',
    );
  }

  return result;
}