1 import 'definition.dart';
2 import 'property.dart';
5 final String stringValue;
8 bool get isMissing => intValue == null;
10 Key(this.stringValue, this.intValue);
11 Key.forDefinition(Definition def)
12 : stringValue = def.name.toLowerCase(),
14 Key.forProperty(Property field)
15 : stringValue = field.name.toLowerCase(),
18 Key withIntValue(int id) => Key(stringValue, id);
20 factory Key.fromJSON(dynamic data) {
21 if (data is! Map<String, dynamic>) {
24 dynamic iv = data["int"];
25 dynamic sv = data["string"];
26 if (iv is int && sv is String) {
32 Map<String, dynamic> serialize() =>
33 <String, dynamic>{"int": intValue, "string": stringValue};