refactor: update deprecated and minor code refactors (#710)

Improve code readability & additional refactoring

Commits:
chore: exclude generated from analyzer

refactor: add SharedPreferences to locator

refactor: access shared pref from locator, and code refactor

refactor: remove unwanted `await`

refactor: remove `const` from `CacheConfig`
This commit is contained in:
Sailesh Dahal
2023-02-21 18:06:56 +05:45
committed by EvadeMaster
parent 3ae4d69110
commit 6829d3cdea
15 changed files with 97 additions and 96 deletions

View File

@ -1,4 +1,5 @@
import 'dart:io';
import 'package:cr_file_saver/file_saver.dart';
import 'package:device_info_plus/device_info_plus.dart';
import 'package:file_picker/file_picker.dart';
@ -74,14 +75,18 @@ class SettingsViewModel extends BaseViewModel {
if (outFile.existsSync()) {
final String dateTime =
DateTime.now().toString().replaceAll(' ', '_').split('.').first;
await CRFileSaver.saveFileWithDialog(SaveFileDialogParams(
sourceFilePath: outFile.path, destinationFileName: 'selected_patches_$dateTime.json',),);
await CRFileSaver.saveFileWithDialog(
SaveFileDialogParams(
sourceFilePath: outFile.path,
destinationFileName: 'selected_patches_$dateTime.json',
),
);
_toast.showBottom('settingsView.exportedPatches');
} else {
_toast.showBottom('settingsView.noExportFileFound');
}
} on Exception catch (e, s) {
Sentry.captureException(e, stackTrace: s);
Sentry.captureException(e, stackTrace: s).ignore();
}
}
@ -101,7 +106,7 @@ class SettingsViewModel extends BaseViewModel {
_toast.showBottom('settingsView.importedPatches');
}
} on Exception catch (e, s) {
await Sentry.captureException(e, stackTrace: s);
Sentry.captureException(e, stackTrace: s).ignore();
_toast.showBottom('settingsView.jsonSelectorErrorMessage');
}
}