ThingDocument.fromJson constructor

ThingDocument.fromJson(
  1. Map<String, dynamic> json
)

Implementation

factory ThingDocument.fromJson(Map<String, dynamic> json) {
  return ThingDocument(
    attributes: (json['attributes'] as Map<String, dynamic>?)
        ?.map((k, e) => MapEntry(k, e as String)),
    connectivity: json['connectivity'] != null
        ? ThingConnectivity.fromJson(
            json['connectivity'] as Map<String, dynamic>)
        : null,
    shadow: json['shadow'] as String?,
    thingGroupNames: (json['thingGroupNames'] as List?)
        ?.whereNotNull()
        .map((e) => e as String)
        .toList(),
    thingId: json['thingId'] as String?,
    thingName: json['thingName'] as String?,
    thingTypeName: json['thingTypeName'] as String?,
  );
}