DeviceInformationChange class Null safety

The object that changes the device information.

The device information change can be used to

  • modify the name of the device and/or
  • modify its Firebase registration token or
  • disable push notifications.

If neither name or fcmRegistrationToken are provided, the provided onSuccess function will be called when execute is invoked.

Usage example for changing device information:

  Future<void> updateDeviceInformation({
    required MobileAuthenticationClient client,
    required String newName,
    required String fcmToken,
  }) async {
    await client.operations.deviceInformationChange
      .onSuccess(() {
        // handle success
      .onError((error) {
        // handle error

Synchronization with retry policy

The retry policy can be useful when updating the Firebase Cloud Messaging token. But since it is not known when the token will be updated, synchronization is necessary and should be done by the caller. Below a sample code is provided that solves the synchronization using the queue library and Completer.

import 'dart:async';
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:queue/queue.dart';

class SampleAppMessagingService {
  final Queue _queue = Queue();

  SampleAppMessagingService() {
    FirebaseMessaging.instance.onTokenRefresh.listen((token) {
      _queue.add(() {
        return _processNewToken(token, client);

  Future<void> _processNewToken(
    MobileAuthenticationClient client,
    String fcmToken,
  ) async {
    final completer = Completer();
    ConstantRetryPolicy retryPolicy = ConstantRetryPolicy(
      maxRetries: 5,
      delayInSeconds: const Duration(seconds: 5),
      .onSuccess(() {
        // Firebase registration token successfully updated
      .onError((error) {
        // handle unsuccessful update
      .catchError((e) {

    return completer.future;




hashCode → int
The hash code for this object.
runtimeType → Type
A representation of the runtime type of the object.


disablePushNotifications() DeviceInformationChange
Disables the push notifications on the server side (i.e. the server will not send authentication push notifications).
execute() → Future<void>
Executes the operation asynchronously.
fcmRegistrationToken(String fcmRegistrationToken) DeviceInformationChange
Specifies the new Firebase Cloud Messaging registration token.
name(String name) DeviceInformationChange
Specifies the new name of the device information.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed.
onError(dynamic onError(DeviceInformationChangeError)) DeviceInformationChange
Specifies the object that will be invoked if the dispatch device information change failed.
onSuccess(Function onSuccess) DeviceInformationChange
Specifies the object that will be invoked if the device information for the user was updated successfully.
requestHeaders(RequestHeaders requestHeaders) DeviceInformationChange
Specifies the additional request headers that must be included in the HTTP requests sent by the operation.
retryPolicy(RetryPolicy retryPolicy) DeviceInformationChange
Specifies the retry policy to be used.
toString() → String
A string representation of this object.


operator ==(Object other) → bool
The equality operator.