setUserInfo static method

Future<bool> setUserInfo({
  1. required String userId,
  2. required List<QiyuUserInfoData> userInfoDataList,
})

Implementation

static Future<bool> setUserInfo({
  required String userId,
  required List<QiyuUserInfoData> userInfoDataList,
}) async {
  if (userId.isEmpty) {
    debugPrint('[$tag] - userId can not be empty');
    return false;
  }
  if (userInfoDataList.isEmpty) {
    debugPrint('[$tag] - data length can not be empty');
    return false;
  }
  // Use json.encode() to get original json-string
  String jsonString = userInfoDataList
      .map((e) {
        return json.encode(e.toJson());
      })
      .toList()
      .toString();
  final bool isSuccessful = await _channel.invokeMethod('setUserInfo', {
    'userId': userId,
    'userInfoDataList': jsonString,
  });
  return isSuccessful;
}