setUserTraits method

Future<bool?> setUserTraits(
  1. UserTraitsModel? userTraits
)

You can assign custom attributes to your users. Those attributes can later be used to trigger the survey or even filter the survey results within Survicate panel. Please keep in mind that user traits are cached, you only have to provide them once, e.g. when user logs in, not after each initialize(). You can also change their values at any time (which may potentially trigger showing the survey).

userTraits the custom attributes to be assigned to your users.

Implementation

Future<bool?> setUserTraits(UserTraitsModel? userTraits) async {
  if (userTraits == null || userTraits.toMap().isEmpty) {
    return false;
  }

  return await _channel.invokeMethod('setUserTraits', userTraits.toMap());
}