whenMaybe<O> method
O
whenMaybe<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()?,
- required O orElse(
- GraphQLType
inherited
Similar to when
, but with optional arguments and
a required default case orElse
, which is executed when none of
the provided functions match this
Implementation
O whenMaybe<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,
required O Function(GraphQLType) orElse,
}) {
return when(
scalar: scalar ?? orElse,
object: object ?? orElse,
input: input ?? orElse,
list: list ?? orElse,
nonNullable: nonNullable ?? orElse,
enum_: enum_ ?? orElse,
union: union ?? orElse,
);
}