Enable avoid_void_async lint

This commit is contained in:
Ming Ming 2022-07-29 02:45:43 +08:00
parent 65d4268954
commit 20fac885a9
17 changed files with 21 additions and 20 deletions

View file

@ -3,6 +3,7 @@ include: package:flutter_lints/flutter.yaml
linter:
rules:
unawaited_futures: true
avoid_void_async: true
depend_on_referenced_packages: false
prefer_interpolation_to_compose_strings: false
no_leading_underscores_for_local_identifiers: false

View file

@ -99,7 +99,7 @@ class MetadataTaskManager {
}
}
void _handleStream() async {
Future<void> _handleStream() async {
await for (final task in _streamController.stream) {
if (Pref().isEnableExifOr()) {
_log.info("[_doTask] Executing task: $task");

View file

@ -54,7 +54,7 @@ void stopService() {
}
@visibleForTesting
void serviceMain() async {
Future<void> serviceMain() async {
_Service._shouldRun.value = true;
WidgetsFlutterBinding.ensureInitialized();

View file

@ -362,7 +362,7 @@ class _AlbumBrowserState extends State<AlbumBrowser>
album: _album));
}
void _onSharePressed(BuildContext context) async {
Future<void> _onSharePressed(BuildContext context) async {
await _showSharedAlbumInfoDialog();
await showDialog(
context: context,

View file

@ -220,7 +220,7 @@ mixin AlbumBrowserMixin<T extends StatefulWidget>
}
}
void _onAddToCollectionPressed(
Future<void> _onAddToCollectionPressed(
BuildContext context, Account account, Album album) async {
Album? newAlbum;
try {

View file

@ -216,7 +216,7 @@ class _AlbumImporterState extends State<AlbumImporter> {
}
}
void _onImportPressed(BuildContext context) async {
Future<void> _onImportPressed(BuildContext context) async {
unawaited(
showDialog(
barrierDismissible: false,

View file

@ -424,7 +424,7 @@ class _DynamicAlbumBrowserState extends State<DynamicAlbumBrowser>
).shareFiles(widget.account, selected);
}
void _onSelectionDeletePressed() async {
Future<void> _onSelectionDeletePressed() async {
SnackBarManager().showSnackBar(
SnackBar(
content: Text(L10n.global()

View file

@ -437,7 +437,7 @@ class _HomeAlbumsState extends State<HomeAlbums>
);
}
void _onSortSelected(album_util.AlbumSort sort) async {
Future<void> _onSortSelected(album_util.AlbumSort sort) async {
await Pref().setHomeAlbumsSort(sort.index);
setState(() {
_transformItems(_bloc.state.items);

View file

@ -421,7 +421,7 @@ class _PersonBrowserState extends State<PersonBrowser>
);
}
void _transformItems(List<Face> items) async {
Future<void> _transformItems(List<Face> items) async {
final files = await PopulatePerson(_c)(widget.account, items);
_backingFiles = files
.sorted(compareFileDateTimeDescending)

View file

@ -52,7 +52,7 @@ class _RootPickerState extends State<RootPicker> {
_initAccount();
}
void _initAccount() async {
Future<void> _initAccount() async {
final c = KiwiContainer().resolve<DiContainer>();
final files = <File>[];
for (final r in widget.account.roots) {

View file

@ -397,7 +397,7 @@ class _SettingsState extends State<Settings> {
}
}
void _onCaptureLogChanged(BuildContext context, bool value) async {
Future<void> _onCaptureLogChanged(BuildContext context, bool value) async {
if (value) {
final result = await showDialog<bool>(
context: context,
@ -1375,7 +1375,7 @@ class _ThemeSettingsState extends State<_ThemeSettings> {
);
}
void _onFollowSystemThemeChanged(bool value) async {
Future<void> _onFollowSystemThemeChanged(bool value) async {
final oldValue = _isFollowSystemTheme;
setState(() {
_isFollowSystemTheme = value;
@ -1394,7 +1394,7 @@ class _ThemeSettingsState extends State<_ThemeSettings> {
}
}
void _onUseBlackInDarkThemeChanged(BuildContext context, bool value) async {
Future<void> _onUseBlackInDarkThemeChanged(BuildContext context, bool value) async {
final oldValue = _isUseBlackInDarkTheme;
setState(() {
_isUseBlackInDarkTheme = value;
@ -1491,7 +1491,7 @@ class _MiscSettingsState extends State<_MiscSettings> {
}
}
void _onPhotosTabSortByNameChanged(bool value) async {
Future<void> _onPhotosTabSortByNameChanged(bool value) async {
final oldValue = _isPhotosTabSortByName;
setState(() {
_isPhotosTabSortByName = value;

View file

@ -239,7 +239,7 @@ class _SlideshowViewerState extends State<SlideshowViewer>
_setupSlideTransition(widget.startIndex);
}
void _onSlideshowTick() async {
Future<void> _onSlideshowTick() async {
if (!mounted) {
return;
}

View file

@ -267,7 +267,7 @@ class _TrashbinBrowserState extends State<TrashbinBrowser>
}
}
void _onEmptyTrashPressed(BuildContext context) async {
Future<void> _onEmptyTrashPressed(BuildContext context) async {
unawaited(
showDialog(
context: context,

View file

@ -156,7 +156,7 @@ class _TrashbinViewerState extends State<TrashbinViewer> {
);
}
void _onRestorePressed() async {
Future<void> _onRestorePressed() async {
final file = widget.streamFiles[_viewerController.currentPage];
_log.info("[_onRestorePressed] Restoring file: ${file.path}");
SnackBarManager().showSnackBar(

View file

@ -93,7 +93,7 @@ class _VideoViewerState extends State<VideoViewer>
_controller.dispose();
}
void _initController(String url) async {
Future<void> _initController(String url) async {
try {
_controller = VideoPlayerController.network(
url,

View file

@ -612,7 +612,7 @@ class _ViewerState extends State<Viewer>
DownloadHandler().downloadFiles(widget.account, [file]);
}
void _onDeletePressed(BuildContext context) async {
Future<void> _onDeletePressed(BuildContext context) async {
final file = widget.streamFiles[_viewerController.currentPage];
_log.info("[_onDeletePressed] Removing file: ${file.path}");
final count = await RemoveSelectionHandler()(
@ -626,7 +626,7 @@ class _ViewerState extends State<Viewer>
}
}
void _onSlideshowPressed() async {
Future<void> _onSlideshowPressed() async {
final result = await showDialog<SlideshowConfig>(
context: context,
builder: (_) => SlideshowDialog(

View file

@ -430,7 +430,7 @@ class _ViewerDetailPaneState extends State<ViewerDetailPane> {
}
}
void _onUnarchivePressed(BuildContext context) async {
Future<void> _onUnarchivePressed(BuildContext context) async {
_log.info("[_onUnarchivePressed] Unarchive file: ${widget.file.path}");
try {
await NotifiedAction(