getCurrentUsername method Null safety
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;
}
}