GraphQLArg class
An annotation for configuring a GraphQLFieldInput within a resolver
if inline is true, the properties of a GraphQLInputObjectType will be inlined into the resolver inputs.
Example:
@GraphQLInput()
class InputModel {
final String name;
final DateTime? birthDate;
const InputModel(this.name, this.birthDate);
factory InputModel.fromJson(Map<String, Object?> json)
=> InputModel(
json['name']! as String,
json['birthDate'] == null
? null : DateTime.parse(json['birthDate']! as String)
);
}
@Mutation()
bool createModel(
ReqCtx ctx,
@GraphQLArg(inline: true) InputModel model,
// The amount!
int amount = 24,
) {
final String name = model.name;
final DateTime? birthDate = model.birthDate;
return birthDate == null || DateTime.now().isAfter(birthDate);
}
Results in the following schema:
input InputModel {
name: String!
birthDate: Date
}
type Mutation {
createModel(
name: String!,
birthDate: Date,
"""The amount!"""
amount: Int! = 24
) : Boolean!
}
Constructors
- GraphQLArg({bool? inline, String? defaultCode, Object? defaultFunc()?})
-
An annotation for configuring a GraphQLFieldInput within a resolver
const
Properties
- defaultCode → String?
-
The Dart code used to create the default value for the argument.
final
- defaultFunc → (Object? Function()?)
-
A function which returns the default value for the argument.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- inline → bool
-
Whether to inline the fields of a GraphQLInputObjectType
inside the parameters.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited