identify method Null safety

Future<bool?> identify(
  1. String? userKey,
  2. {LaunchDarklyUser? user,
  3. Map<String, dynamic>? custom,
  4. Map<String, dynamic>? privateCustom}

Changes user context.

If your app is used by multiple users on a single device, you may want to change users and have separate flag settings for each user. Use this method to switch user contexts.

userKey is the user id considered by LaunchDarkly for feature flag targeting and rollouts (see init).

You can pass built-in user attributes as LaunchDarklyUser in user. You can pass custom attributes and private custom attributes in custom and privateCustom maps accordingly. Please note private attributes take precedence over non-private ones.


Future<bool?> identify(
  String? userKey, {
  LaunchDarklyUser? user,
  Map<String, dynamic>? custom,
  Map<String, dynamic>? privateCustom,
}) =>
    _channel.invokeMethod('identify', <String, dynamic>{
      'userKey': userKey,
      'user': user?.toMap(),
      'custom': {
        if (custom != null) ...custom,
        if (privateCustom != null) ...privateCustom,
      'privateAttributes': [
        if (user != null) ...user.privateAttributes,
        if (privateCustom != null) ...privateCustom.keys,