SentryUser constructor

SentryUser({
  1. String? id,
  2. String? username,
  3. String? email,
  4. String? ipAddress,
  5. String? segment,
  6. SentryGeo? geo,
  7. String? name,
  8. Map<String, dynamic>? data,
  9. @Deprecated('Will be removed in v8. Use [data] instead') Map<String, dynamic>? extras,
  10. Map<String, dynamic>? unknown,
})

You should provide at least one of id, email, ipAddress, username for Sentry to be able to tell you how many users are affected by one issue, for example. Sending a user that has none of these attributes and only custom attributes is valid, but not as useful.

Implementation

SentryUser({
  this.id,
  this.username,
  this.email,
  this.ipAddress,
  this.segment,
  this.geo,
  this.name,
  Map<String, dynamic>? data,
  @Deprecated('Will be removed in v8. Use [data] instead')
  Map<String, dynamic>? extras,
  this.unknown,
})  : assert(
        id != null ||
            username != null ||
            email != null ||
            ipAddress != null ||
            segment != null,
      ),
      data = data == null ? null : Map.from(data),
      // ignore: deprecated_member_use_from_same_package
      extras = extras == null ? null : Map.from(extras);