whenOrNull<O> method
O?
whenOrNull<O>({
- O? enum_(
- GraphQLEnumType<
Json>
- GraphQLEnumType<
- O? scalar()?,
- O? object(
- GraphQLObjectType<
Json>
- GraphQLObjectType<
- O? input(
- GraphQLInputObjectType<
Json>
- GraphQLInputObjectType<
- O? union(
- GraphQLUnionType<
Json>
- GraphQLUnionType<
- O? list(
- GraphQLListType
- O? nonNullable()?,
inherited
Similar to when
, but with optional arguments. Returns null
when none of the provided functions match this
Implementation
O? whenOrNull<O>({
O? Function(GraphQLEnumType<Value>)? enum_,
O? Function(GraphQLScalarType<Value, Serialized>)? scalar,
O? Function(GraphQLObjectType<Value>)? object,
O? Function(GraphQLInputObjectType<Value>)? input,
O? Function(GraphQLUnionType<Value>)? union,
O? Function(GraphQLListType)? list,
O? Function(GraphQLNonNullType<Value, Serialized>)? nonNullable,
}) {
O? orElse(GraphQLType _) {
return null;
}
return when(
scalar: scalar ?? orElse,
object: object ?? orElse,
input: input ?? orElse,
list: list ?? orElse,
nonNullable: nonNullable ?? orElse,
enum_: enum_ ?? orElse,
union: union ?? orElse,
);
}