syncAll method

  1. @override
Future<Map<String, int>> syncAll({
  1. List<String> consentStates = const ['allowed'],
})
override

Sync all conversations from network

Implementation

@override
Future<Map<String, int>> syncAll({List<String> consentStates = const ['allowed']}) async {
  try {
    final params = <String, dynamic>{
      'consentStates': consentStates,
    }.jsify() as JSObject;

    final result = await _promiseToFuture(
      _clientManager.syncAll(params),
    );

    final map = _jsObjectToMap(result);
    return {'numGroupsSynced': (map['numGroupsSynced'] as num?)?.toInt() ?? 0};
  } catch (e) {
    throw Exception('Failed to sync all: $e');
  }
}