flutter_desktop: remove unnecessary control flow

Signed-off-by: fufesou <shuanglongchen@yeah.net>
This commit is contained in:
fufesou 2022-08-03 22:13:40 +08:00
parent 7a2de5d280
commit 0488eb31f5
3 changed files with 8 additions and 12 deletions

View File

@ -47,7 +47,7 @@ class AbModel with ChangeNotifier {
} }
Future<String> getApiServer() async { Future<String> getApiServer() async {
return await bind.mainGetApiServer() ?? ""; return await bind.mainGetApiServer();
} }
void reset() { void reset() {

View File

@ -292,14 +292,12 @@ class FileModel extends ChangeNotifier {
onReady() async { onReady() async {
_localOption.home = _ffi.target?.getByName("get_home_dir") ?? ""; _localOption.home = _ffi.target?.getByName("get_home_dir") ?? "";
_localOption.showHidden = (await bind.sessionGetPeerOption( _localOption.showHidden = (await bind.sessionGetPeerOption(
id: _ffi.target?.id ?? "", name: "local_show_hidden")) id: _ffi.target?.id ?? "", name: "local_show_hidden"))
?.isNotEmpty ?? .isNotEmpty;
false;
_remoteOption.showHidden = (await bind.sessionGetPeerOption( _remoteOption.showHidden = (await bind.sessionGetPeerOption(
id: _ffi.target?.id ?? "", name: "remote_show_hidden")) id: _ffi.target?.id ?? "", name: "remote_show_hidden"))
?.isNotEmpty ?? .isNotEmpty;
false;
_remoteOption.isWindows = _ffi.target?.ffiModel.pi.platform == "Windows"; _remoteOption.isWindows = _ffi.target?.ffiModel.pi.platform == "Windows";
debugPrint("remote platform: ${_ffi.target?.ffiModel.pi.platform}"); debugPrint("remote platform: ${_ffi.target?.ffiModel.pi.platform}");
@ -307,11 +305,9 @@ class FileModel extends ChangeNotifier {
await Future.delayed(Duration(milliseconds: 100)); await Future.delayed(Duration(milliseconds: 100));
final local = (await bind.sessionGetPeerOption( final local = (await bind.sessionGetPeerOption(
id: _ffi.target?.id ?? "", name: "local_dir")) ?? id: _ffi.target?.id ?? "", name: "local_dir"));
"";
final remote = (await bind.sessionGetPeerOption( 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(local.isEmpty ? _localOption.home : local, isLocal: true);
openDirectory(remote.isEmpty ? _remoteOption.home : remote, isLocal: false); openDirectory(remote.isEmpty ? _remoteOption.home : remote, isLocal: false);
await Future.delayed(Duration(seconds: 1)); await Future.delayed(Duration(seconds: 1));

View File

@ -18,7 +18,7 @@ class UserModel extends ChangeNotifier {
if (userName.isNotEmpty) { if (userName.isNotEmpty) {
return userName.value; return userName.value;
} }
final userInfo = await bind.mainGetLocalOption(key: 'user_info') ?? "{}"; final userInfo = await bind.mainGetLocalOption(key: 'user_info');
if (userInfo.trim().isEmpty) { if (userInfo.trim().isEmpty) {
return ""; return "";
} }