Skip to content

Commit ecd780a

Browse files
authored
chore: Linter updates: Void-Async (#68)
* Update analysis_options.yaml * fix: Update the code to match the new rules
1 parent 3c49ded commit ecd780a

File tree

4 files changed

+10
-4
lines changed

4 files changed

+10
-4
lines changed

analysis_options.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ linter:
2525
- avoid_types_as_parameter_names
2626
- avoid_unnecessary_containers
2727
- avoid_unused_constructor_parameters
28+
- avoid_void_async
2829
- await_only_futures
2930
- camel_case_extensions
3031
- curly_braces_in_flow_control_structures

lib/data/interceptor/meta_interceptor.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,10 @@ class MetaInterceptor extends InterceptorsWrapper {
1212
final AppFlavor flavor;
1313

1414
@override
15-
void onRequest(
16-
RequestOptions options, RequestInterceptorHandler handler) async {
15+
Future<void> onRequest(
16+
RequestOptions options,
17+
RequestInterceptorHandler handler,
18+
) async {
1719
if (options.headers['Accept'] == null) {
1820
options.headers['Accept'] = 'application/json; charset=UTF-8';
1921
}

lib/main_common.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_template/injection/dependencies.dart';
33
import 'package:flutter_template/presentation/app.dart';
4+
45
import 'presentation/app_flavor.dart';
56

7+
// ignore: avoid_void_async
68
void mainCommon(AppFlavor flavor) async {
79
WidgetsFlutterBinding.ensureInitialized();
810
await DependencyManager.inject(flavor);

lib/presentation/feature/profile/profile_cubit.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ class ProfileCubit extends Cubit<ProfileState> {
1313
@factoryParam ProfileState? state,
1414
}) : super(state ?? ProfileState.initial());
1515

16-
void load() async {
16+
Future<void> load() async {
1717
if (state.isLoading) return;
1818

1919
emit(state.copyWith(isLoading: true));
20-
await profileService
20+
21+
return profileService
2122
.getProfileName()
2223
.then(
2324
(value) => emit(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy