diff --git a/flutter/lib/models/ab_model.dart b/flutter/lib/models/ab_model.dart index b9740ed8f..18bb73c3f 100644 --- a/flutter/lib/models/ab_model.dart +++ b/flutter/lib/models/ab_model.dart @@ -47,7 +47,7 @@ class AbModel with ChangeNotifier { } Future getApiServer() async { - return await bind.mainGetApiServer() ?? ""; + return await bind.mainGetApiServer(); } void reset() { diff --git a/flutter/lib/models/file_model.dart b/flutter/lib/models/file_model.dart index e86ac1de2..35deabac5 100644 --- a/flutter/lib/models/file_model.dart +++ b/flutter/lib/models/file_model.dart @@ -292,14 +292,12 @@ class FileModel extends ChangeNotifier { onReady() async { _localOption.home = _ffi.target?.getByName("get_home_dir") ?? ""; _localOption.showHidden = (await bind.sessionGetPeerOption( - id: _ffi.target?.id ?? "", name: "local_show_hidden")) - ?.isNotEmpty ?? - false; + id: _ffi.target?.id ?? "", name: "local_show_hidden")) + .isNotEmpty; _remoteOption.showHidden = (await bind.sessionGetPeerOption( - id: _ffi.target?.id ?? "", name: "remote_show_hidden")) - ?.isNotEmpty ?? - false; + id: _ffi.target?.id ?? "", name: "remote_show_hidden")) + .isNotEmpty; _remoteOption.isWindows = _ffi.target?.ffiModel.pi.platform == "Windows"; debugPrint("remote platform: ${_ffi.target?.ffiModel.pi.platform}"); @@ -307,11 +305,9 @@ class FileModel extends ChangeNotifier { await Future.delayed(Duration(milliseconds: 100)); final local = (await bind.sessionGetPeerOption( - id: _ffi.target?.id ?? "", name: "local_dir")) ?? - ""; + id: _ffi.target?.id ?? "", name: "local_dir")); final remote = (await bind.sessionGetPeerOption( - id: _ffi.target?.id ?? "", name: "remote_dir")) ?? - ""; + id: _ffi.target?.id ?? "", name: "remote_dir")); openDirectory(local.isEmpty ? _localOption.home : local, isLocal: true); openDirectory(remote.isEmpty ? _remoteOption.home : remote, isLocal: false); await Future.delayed(Duration(seconds: 1)); diff --git a/flutter/lib/models/user_model.dart b/flutter/lib/models/user_model.dart index 539211664..b43b4510b 100644 --- a/flutter/lib/models/user_model.dart +++ b/flutter/lib/models/user_model.dart @@ -18,7 +18,7 @@ class UserModel extends ChangeNotifier { if (userName.isNotEmpty) { return userName.value; } - final userInfo = await bind.mainGetLocalOption(key: 'user_info') ?? "{}"; + final userInfo = await bind.mainGetLocalOption(key: 'user_info'); if (userInfo.trim().isEmpty) { return ""; }