CommonDataClass<T extends CommonDataClass<T>> class abstract

A base class for data model classes, must implement String id, fromMap and toMap methods

import 'package:get_storage_pro/src/common_data_class.dart';
@gsp
class YourModel extends CommonDataClass<YourModel> {
  final String id;
  final String name;

  YourModel({required this.id, required this.name});


  factory YourModel.fromMap(Map<String, dynamic> map) {
    return YourModel(
      id: map['id'] as String,
      name: map['name'] as String,
    );
  }

  @override
  Map<String, dynamic> toMap() {
    return {'id': id, 'name': name};
  }
}

Constructors

CommonDataClass.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
id String
The unique identifier for this data object. Must have String id attribute in your data class.
no setter
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
toMap() Map<String, dynamic>
A map representation of the data object.
toString() String
A string representation of this object.
inherited

Operators

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