getCurrentUsername method Null safety
Gets the current login user ID.
Return The current login user ID.
Implementation
Future<String?> getCurrentUsername() async {
Map result = await _channel.invokeMethod(ChatMethodKeys.getCurrentUser);
try {
EMError.hasErrorFromResult(result);
_currentUsername = result[ChatMethodKeys.getCurrentUser];
if (_currentUsername != null) {
if (_currentUsername!.length == 0) {
_currentUsername = null;
}
}
return _currentUsername;
} on EMError catch (e) {
throw e;
}
}