identify method
Ties this install's reports to userId, for as long as the consent
category the application declared under dartvel.crashes.identity is
granted in consent. Null signs out.
Refused when the application declared no category: a user id with no consent behind it is exactly what a crash report must not carry, and quietly ignoring the call would look like it worked. Before installation the identity is held and applied when crash reporting is installed.
Implementation
void identify(String? userId, {required DVConsent consent}) {
final DVCrashInstallation? installation = _installation;
if (installation == null) {
_pendingIdentity = (userId, consent);
return;
}
final DVCrashIdentity? identity = installation._identity;
if (identity == null) {
throw StateError(
'DV.Crashes.identify needs a consent category to bind the user id '
'to. Declare dartvel.crashes.identity.consent in pubspec.yaml with the '
'category a crash report may carry a user id under; without one no '
'report is tied to an account.',
);
}
identity.identify(userId, consent: consent);
}