thingsboard / dart_thingsboard_client

ThingsBoard API client library for Dart developers.
BSD 3-Clause "New" or "Revised" License
59 stars 30 forks source link

Error by adding user to user group #8

Closed Dmuldoraf closed 1 year ago

Dmuldoraf commented 2 years ago

Hi,

Situation I tried to change the user group of new created user from all to customer administators. Therefore I used the following code snippet:

List<String> userList = [];
userList.add("aaaaaaaaaaaaa-11ec-bbbb-c14a5834e2da");
userList.add("bbbbbbbbbbb-11ec-aaaa-c14a5812e1da");
      await _tbClient
          .getEntityGroupService()
          .addEntitiesToEntityGroup(
              "43aaaa80-c9b5-1111-9aa8-0baaaaa0a69b", userList)
          .then((value) => print("done"))
          .catchError((onError) => print("in addUserToGroup(): $onError"));

Problem The code throws an error during the execution, although the users being added to the group. How can I prevent this error?

`Exception has occurred. ThingsboardError (ThingsboardError: message: [type 'String' is not a subtype of type 'Map<String, dynamic>?' in type cast], errorCode: 2, status: null

0 toThingsboardError (package:thingsboard_pe_client/src/error/_thingsboard_error_handler_io.dart:86:18)

1 ThingsboardClient.post (package:thingsboard_pe_client/src/thingsboard_client_base.dart:227:13)

` .... _Thingsboardversion PE 3.3.3_ _Flutterversion 2.10.5 thingsboard_pe_client: ^1.0.3_