getUnreadCount method
Fetch unread messages count from the SDK.
This method returns the number of unread messages for the current user. Useful for showing badges or notifications.
Returns the number of unread messages, or 0 if none or if an error occurred.
Implementation
@override
Future<int> getUnreadCount() async {
try {
// Request unread message count from native SDK
final result = await methodChannel.invokeMethod<int>('getUnreadCount');
// Return count or 0 if null/error
return result ?? 0;
} on PlatformException catch (e) {
// Log error and return 0 on platform exception
debugPrint('Failed to get unread count: ${e.message}');
return 0;
}
}