setUserData static method

  1. @Deprecated('This function is deprecated, please use "setUserProperties" instead')
Future<String?> setUserData(
  1. Map<String, Object> options
)

Sets the user data. Should be called after init. returns the error or success message

Implementation

@Deprecated('This function is deprecated, please use "setUserProperties" instead')
static Future<String?> setUserData(Map<String, Object> options) async {
  if (!_instance._countlyState.isInitialized) {
    String message = '"initWithConfig" must be called before "setUserData"';
    log('setUserData, $message', logLevel: LogLevel.ERROR);
    return message;
  }
  int optionsCount = options.length;
  log('Calling "setUserData" with options Count:[$optionsCount]');
  List<dynamic> args = [];
  Map<String, String> userData = _getUserData(options);
  args.add(userData);
  final String? result = await _channel.invokeMethod('setuserdata', <String, dynamic>{'data': json.encode(args)});
  return result;
}