readFCMTokenFromStorage static method

Future<String> readFCMTokenFromStorage()

Read FCM Token from storage

Implementation

static Future<String> readFCMTokenFromStorage() async {
  final data = await _doc.get();
  if (data != null) {
    if (data.isNotEmpty && data.containsKey('token')) {
      final token = data['token'] as String;
      return token.trim();
    }
  }

  //creates the token so it doesn't always return null
  await saveFCMTokenToStorage('');
  return '';
}