fetchDevices method

Future<List<AuthDevice>> fetchDevices()

Retrieves all tracked devices for the current user.

For more information about device tracking, see the Amplify docs.

Examples

import 'package:amplify_auth_cognito/amplify_auth_cognito.dart';
import 'package:amplify_flutter/amplify_flutter.dart';
Future<void> fetchAllDevices() async {
  try {
    final devices = await Amplify.Auth.fetchDevices();
    for (final device in devices) {
      safePrint('Device: $device');
    }
  } on AuthException catch (e) {
    safePrint('Fetch devices failed with error: $e');
  }
}

Implementation

Future<List<AuthDevice>> fetchDevices() => identifyCall(
      AuthCategoryMethod.fetchDevices,
      () => defaultPlugin.fetchDevices(),
    );