EngineModel class Null safety

A model of an entity within the engine.

This class should be annotated with @CopyWith() and @JsonSerializable()

Example

import 'package:irte_engine/irte_engine.dart';

part 'example_item.g.dart';

@CopyWith()
@JsonSerializable()
class ExampleItem extends EngineModel {
  ExampleItem({this.id = '', this.name = ''});

  final String id;
  final String name;

  @override
  Map<String, dynamic> toJson() => _$ExampleItemToJson(this);

  static fromJson(Map<String, dynamic> json) => _$ExampleItemFromJson(json);
}

main() {
  ExampleItem item = ExampleItem(id: 'id', name: 'name');
  print(item); // ExampleItem(id: id, name: name)
  ExampleItem copy = item.copyWith(id: 'newId');
  print(copy); // ExampleItem(id: newId, name: name)
}
Implemented types
Implementers

Constructors

EngineModel()

Properties

hashCode int
The hash code for this object. [...]
read-only, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited

Methods

copyWith() → dynamic
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
inherited
toJson() Json
Returns the json representation of this instance
inherited
toString() String
A string representation of this object. [...]
inherited

Operators

operator ==(Object other) bool
The equality operator. [...]
inherited