dart_thingsboard_client
dart_thingsboard_client copied to clipboard
Error: type 'Null' is not a subtype of type 'String' when calling getEntityRelationService().findInfoByQuery
Environment
- ThingsBoard: 3.6.2
- Dart API: 1.0.8
Description Got exception when tried to call getEntityRelationService().findInfoByQuery, the root cause is that 'fromName' of response is null, the same query can be executed fine with REST API.
RelationsSearchParameters parameters = RelationsSearchParameters(rootId: 'bcbca450-c1a8-11ee-9f93-492ffd078c6c', rootType: EntityType.ASSET);
RelationEntityTypeFilter filter = RelationEntityTypeFilter('Contains', [EntityType.DEVICE]);
EntityRelationsQuery query = EntityRelationsQuery(parameters: parameters, filters: [filter]);
List<EntityRelation> relations = await relationService.findInfoByQuery(query);
D:/flutter/bin/cache/dart-sdk/bin/dart.exe --enable-asserts D:\src\dart_test\bin\dart_test.dart
Error: type 'Null' is not a subtype of type 'String'
Stack: #0 new EntityRelationInfo.fromJson (package:thingsboard_client/src/model/relation_models.dart:183:18)
#1 EntityRelationService.findInfoByQuery.<anonymous closure> (package:thingsboard_client/src/service/entity_relation_service.dart:157:57)
#2 MappedListIterable.elementAt (dart:_internal/iterable.dart:425:31)
#3 ListIterator.moveNext (dart:_internal/iterable.dart:354:26)
#4 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:189:27)
#5 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
#6 new List.of (dart:core-patch/array_patch.dart:39:18)
#7 ListIterable.toList (dart:_internal/iterable.dart:224:7)
#8 EntityRelationService.findInfoByQuery (package:thingsboard_client/src/service/entity_relation_service.dart:157:70)
<asynchronous suspension>
#9 main (file:///D:/src/dart_test/bin/dart_test.dart:13:38)
<asynchronous suspension>