Storable class

Denotes the class can be stored in the datastore. Classes with this annotation are expected to have a field named id of type ObjectId as well as (currently) provide their own toJson/fromJson methods.

Example:

import 'package:shorebird/annotations.dart';
import 'package:shorebird/shorebird.dart';

@Storable()
class User {
 ObjectId id;
 String name;
 User(this.name);
}

shorebird generate will generate ClassInfo

shorebird generate does not yet know how to generate toJson/fromJson methods (but hopefully it will soon), so you will need to implement those yourself or use json_serializable to do so.

If you use JsonSerializable, you will also need to use the @ObjectIdConverter() annotation on the class.

Constructors

Storable()
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