Skip to content

Commit

Permalink
Fix flutter analyze
Browse files Browse the repository at this point in the history
  • Loading branch information
BhasherBEL committed Jun 8, 2023
1 parent f207612 commit 5248ffc
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 13 deletions.
6 changes: 5 additions & 1 deletion lib/components/pages/project/expenses/new_entry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class NewEntryPage extends StatelessWidget {
if (key.currentState!.validate()) {
Item item = await bill.toItemOf(project);
await item.conn.saveRecursively();
Navigator.pop(context, true);
if (context.mounted) Navigator.pop(context, true);
}
},
child: NewEntrySubPage(
Expand Down Expand Up @@ -141,6 +141,7 @@ class _NewEntrySubPageState extends State<NewEntrySubPage> {
setState(() {
widget.bill.amount = parsed;
});
// ignore: empty_catches
} catch (e) {}
},
),
Expand Down Expand Up @@ -357,6 +358,7 @@ class _NewEntrySubPageState extends State<NewEntrySubPage> {
double.parse(fixedsController[participant]!.text) != price) {
fixedsController[participant]!.text = price.toStringAsFixed(2);
}
// ignore: empty_catches
} catch (e) {}

rows.add(TableRow(
Expand Down Expand Up @@ -412,6 +414,7 @@ class _NewEntrySubPageState extends State<NewEntrySubPage> {
? double.parse(value)
: null);
});
// ignore: empty_catches
} catch (e) {}
},
textAlign: TextAlign.center,
Expand Down Expand Up @@ -453,6 +456,7 @@ class _NewEntrySubPageState extends State<NewEntrySubPage> {
widget.bill.shares[participant] =
BillPart(fixed: double.parse(value));
});
// ignore: empty_catches
} catch (e) {}
},
textAlign: TextAlign.center,
Expand Down
4 changes: 3 additions & 1 deletion lib/components/pages/projects_list/projects_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ class _ProjectsListState extends State<ProjectsList> {
AppData.current = project;
await project.conn.loadParticipants();
await project.conn.loadEntries();
navigatorPush(context, () => ProjectPage(project));
if (context.mounted) {
navigatorPush(context, () => ProjectPage(project));
}
},
title: Text(project.name),
subtitle: Text(
Expand Down
4 changes: 3 additions & 1 deletion lib/model/app_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ class AppData {
Project.fromName(sharedPreferences.getString("lastProject")!);
await _current!.conn.loadParticipants();
await _current!.conn.loadEntries();
} catch (e) {}
} catch (e) {
sharedPreferences.remove("lastProject");
}
}

final appLinks = AppLinks();
Expand Down
5 changes: 0 additions & 5 deletions lib/model/connectors/local/provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ class LocalProvider extends Provider {
return true;
}

@override
String getInstance() {
return "local";
}

static Future<bool> checkCredentials(Instance instance) async {
return true;
}
Expand Down
1 change: 0 additions & 1 deletion lib/model/connectors/pocketbase/participant.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class PocketBaseParticipant implements ExternalConnector {
}
await p.conn.save();
}
;
return true;
}
}
2 changes: 0 additions & 2 deletions lib/model/connectors/pocketbase/project.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class PocketBaseProject extends ExternalConnector<Project> {
return false;
}

@override
Future<bool> sync() async {
await project.provider.checkConnection();
if (project.remoteId == null ||
Expand Down Expand Up @@ -77,7 +76,6 @@ class PocketBaseProject extends ExternalConnector<Project> {
return true;
}

@override
Future<bool> checkUpdate() async {
RecordModel record = await collection.getOne(project.remoteId!);
DateTime updated = DateTime.parse(record.updated);
Expand Down
3 changes: 2 additions & 1 deletion lib/model/project.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class Project {
try {
currentParticipant = participants
.firstWhere((element) => element.localId == currentParticipantId);
// ignore: empty_catches
} on StateError {}
}

Expand Down Expand Up @@ -144,7 +145,7 @@ class Project {
DateTime st = DateTime.now();
bool res = await provider.sync();
notSyncCount = 0;
return Tuple2(true,
return Tuple2(res,
(DateTime.now().difference(st).inMilliseconds / 1000).toString());
} catch (e) {
return Tuple2(false, e.toString());
Expand Down
1 change: 0 additions & 1 deletion lib/utils/formatter/decimal.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class DecimalTextInputFormatter extends TextInputFormatter {
Expand Down

0 comments on commit 5248ffc

Please sign in to comment.