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 {
return await bind.mainGetApiServer() ?? "";
return await bind.mainGetApiServer();
}
void reset() {

View File

@ -293,13 +293,11 @@ class FileModel extends ChangeNotifier {
_localOption.home = _ffi.target?.getByName("get_home_dir") ?? "";
_localOption.showHidden = (await bind.sessionGetPeerOption(
id: _ffi.target?.id ?? "", name: "local_show_hidden"))
?.isNotEmpty ??
false;
.isNotEmpty;
_remoteOption.showHidden = (await bind.sessionGetPeerOption(
id: _ffi.target?.id ?? "", name: "remote_show_hidden"))
?.isNotEmpty ??
false;
.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));

View File

@ -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 "";
}