You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`OneSignal.User.setLanguage("en");`|*Set the 2-character language for this user.*|
212
+
|`OneSignal.User.addObserver(OnUserChangeObserver observer);` <br><br>**_See below for usage_**|*Add a User State observer which contains the nullable onesignalId and externalId. The listener will be fired when these values change.*|
213
+
|`await OneSignal.User.getOnesignalId();`|*Returns the nullable OneSignal ID for the current user.*|
214
+
|`await OneSignal.User.getExternalId();`|*Returns the nullable External ID for the current user.*|
212
215
|`OneSignal.User.addAlias("ALIAS_LABEL", "ALIAS_ID");`|*Set an alias for the current user. If this alias label already exists on this user, it will be overwritten with the new alias id.*|
213
216
|`OneSignal.User.addAliases({ALIAS_LABEL_01: "ALIAS_ID_01", ALIAS_LABEL_02: "ALIAS_ID_02"});`|*Set aliases for the current user. If any alias already exists, it will be overwritten to the new values.*|
214
217
|`OneSignal.User.removeAlias("ALIAS_LABEL");`|*Remove an alias from the current user.*|
@@ -223,6 +226,20 @@ The User name space is accessible via `OneSignal.User` and provides access to us
223
226
|`OneSignal.User.removeTags(["KEY_01", "KEY_02"]);`|*Remove multiple tags with the provided keys from the current user.*|
224
227
|`OneSignal.User.getTags();`|*Returns the local tags for the current user.*|
225
228
229
+
### User State Observer
230
+
231
+
The `OnUserChangeObserver` will be fired when the user changes. This method's parameter is the current `UserChangedState` which includes the current state.
232
+
233
+
```dart
234
+
OneSignal.User.addObserver((state) {
235
+
var userState = state.jsonRepresentation();
236
+
print('OneSignal user changed: $userState');
237
+
});
238
+
239
+
/// Remove a user state observer that has been previously added.
0 commit comments