GraphQLInterface class

Publishes an abstract class that a type reaches through extends as a GraphQL interface.

An abstract class reached through implements is already one and needs nothing: Dart implements is a promise about shape, which is what a GraphQL interface is. extends is implementation reuse, so a superclass hands its fields to the type and stays out of the schema, unless it carries this.

/// Something the catalogue dates.
@GraphQLInterface()
abstract class Timestamped {
  /// Creates the base.
  const Timestamped();

  /// When the record was created.
  DateTime get createdAt;
}

class Product extends Timestamped {
  @override
  final DateTime createdAt;

  const Product({required this.createdAt});
}
interface Timestamped {
  createdAt: DateTime!
}

type Product implements Timestamped {
  createdAt: DateTime!
}
Annotations
  • @Target.new({TargetKind.classType})

Constructors

GraphQLInterface()
Publishes the class as an interface.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
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