Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flutter_news_example/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:very_good_analysis/analysis_options.7.0.0.yaml
include: package:very_good_analysis/analysis_options.10.0.0.yaml
analyzer:
errors:
document_ignores: ignore
Expand Down
2 changes: 1 addition & 1 deletion flutter_news_example/api/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:very_good_analysis/analysis_options.7.0.0.yaml
include: package:very_good_analysis/analysis_options.10.0.0.yaml
analyzer:
errors:
document_ignores: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ class FlutterNewsExampleApiClient {
}) async {
final uri = Uri.parse('$_baseUrl/api/v1/feed').replace(
queryParameters: <String, String>{
if (categoryId != null) 'category': categoryId,
'category': ?categoryId,
if (limit != null) 'limit': '$limit',
if (offset != null) 'offset': '$offset',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,7 @@ const _technologyCategory = Category(id: 'technology', name: 'Technology');
const _healthCategory = Category(id: 'health', name: 'Health');
const _scienceCategory = Category(id: 'science', name: 'Science');

const _categories = [
const List<Category> _categories = [
_topCategory,
_sportsCategory,
_technologyCategory,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include: package:very_good_analysis/analysis_options.7.0.0.yaml
include: package:very_good_analysis/analysis_options.10.0.0.yaml
analyzer:
errors:
document_ignores: ignore
Expand Down
2 changes: 1 addition & 1 deletion flutter_news_example/api/packages/news_blocks/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dev_dependencies:
json_serializable: ^6.9.5
mocktail: ^1.0.2
test: ^1.21.4
very_good_analysis: ^7.0.0
very_good_analysis: ^10.0.0

dependency_overrides:
frontend_server_client: ^4.0.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: prefer_const_constructors_in_immutables, lines_longer_than_80_chars, prefer_const_constructors
// ignore_for_file: prefer_const_constructors

import 'package:news_blocks/news_blocks.dart';
import 'package:test/test.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore_for_file: prefer_const_constructors

import 'package:news_blocks/news_blocks.dart';
import 'package:test/test.dart';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// ignore_for_file: prefer_const_constructors

import 'package:news_blocks/news_blocks.dart';
import 'package:test/test.dart';

Expand Down
4 changes: 2 additions & 2 deletions flutter_news_example/api/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,10 @@ packages:
dependency: "direct dev"
description:
name: very_good_analysis
sha256: "62d2b86d183fb81b2edc22913d9f155d26eb5cf3855173adb1f59fac85035c63"
sha256: "96245839dbcc45dfab1af5fa551603b5c7a282028a64746c19c547d21a7f1e3a"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
version: "10.0.0"
vm_service:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion flutter_news_example/api/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ dev_dependencies:
json_serializable: ^6.9.5
mocktail: ^1.0.4
test: ^1.25.12
very_good_analysis: ^7.0.0
very_good_analysis: ^10.0.0

dependency_overrides:
frontend_server_client: ^4.0.0
8 changes: 4 additions & 4 deletions flutter_news_example/lib/ads/bloc/full_screen_ads_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ class FullScreenAdsBloc extends Bloc<FullScreenAdsEvent, FullScreenAdsState> {
state.interstitialAd?.fullScreenContentCallback =
ads.FullScreenContentCallback(
onAdDismissedFullScreenContent: (ad) => ad.dispose(),
onAdFailedToShowFullScreenContent: (ad, error) {
ad.dispose();
onAdFailedToShowFullScreenContent: (ad, error) async {
await ad.dispose();
addError(error);
},
);
Expand Down Expand Up @@ -201,8 +201,8 @@ class FullScreenAdsBloc extends Bloc<FullScreenAdsEvent, FullScreenAdsState> {
state.rewardedAd?.fullScreenContentCallback =
ads.FullScreenContentCallback(
onAdDismissedFullScreenContent: (ad) => ad.dispose(),
onAdFailedToShowFullScreenContent: (ad, error) {
ad.dispose();
onAdFailedToShowFullScreenContent: (ad, error) async {
await ad.dispose();
addError(error);
},
);
Expand Down
4 changes: 2 additions & 2 deletions flutter_news_example/lib/analytics/bloc/analytics_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ class AnalyticsBloc extends Bloc<AnalyticsEvent, AnalyticsState> {
}

@override
Future<void> close() {
_userSubscription.cancel();
Future<void> close() async {
await _userSubscription.cancel();
return super.close();
}
}
4 changes: 2 additions & 2 deletions flutter_news_example/lib/app/bloc/app_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ class AppBloc extends Bloc<AppEvent, AppState> {
}

@override
Future<void> close() {
_userSubscription.cancel();
Future<void> close() async {
await _userSubscription.cancel();
return super.close();
}
}
2 changes: 1 addition & 1 deletion flutter_news_example/lib/article/view/article_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class ArticleView extends StatelessWidget {
);

return PopScope(
onPopInvokedWithResult: (_, __) => _onPop(context),
onPopInvokedWithResult: (_, _) => _onPop(context),
child: HasToShowInterstitialAdListener(
interstitialAdBehavior: interstitialAdBehavior,
child: HasReachedArticleLimitListener(
Expand Down
16 changes: 10 additions & 6 deletions flutter_news_example/lib/article/widgets/article_content.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:app_ui/app_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand Down Expand Up @@ -37,12 +39,14 @@ class ArticleContent extends StatelessWidget {
child: BlocListener<ArticleBloc, ArticleState>(
listener: (context, state) {
if (state.status == ArticleStatus.failure && state.content.isEmpty) {
Navigator.of(context).push<void>(
NetworkError.route(
onRetry: () {
context.read<ArticleBloc>().add(const ArticleRequested());
Navigator.of(context).pop();
},
unawaited(
Navigator.of(context).push<void>(
NetworkError.route(
onRetry: () {
context.read<ArticleBloc>().add(const ArticleRequested());
Navigator.of(context).pop();
},
),
),
);
} else if (state.status == ArticleStatus.shareFailure) {
Expand Down
4 changes: 2 additions & 2 deletions flutter_news_example/lib/feed/view/feed_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ class _FeedViewPopulatedState extends State<FeedViewPopulated>
.map(
(category) => CategoryTab(
categoryName: category.name,
onDoubleTap: () {
_controllers[category]?.animateTo(
onDoubleTap: () async {
await _controllers[category]?.animateTo(
0,
duration: _categoryScrollToTopDuration,
curve: Curves.ease,
Expand Down
20 changes: 12 additions & 8 deletions flutter_news_example/lib/feed/widgets/category_feed.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:app_ui/app_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand Down Expand Up @@ -34,14 +36,16 @@ class CategoryFeed extends StatelessWidget {
return BlocListener<FeedBloc, FeedState>(
listener: (context, state) {
if (state.status == FeedStatus.failure && state.feed.isEmpty) {
Navigator.of(context).push<void>(
NetworkError.route(
onRetry: () {
context.read<FeedBloc>().add(
FeedRefreshRequested(category: category),
);
Navigator.of(context).pop();
},
unawaited(
Navigator.of(context).push<void>(
NetworkError.route(
onRetry: () {
context.read<FeedBloc>().add(
FeedRefreshRequested(category: category),
);
Navigator.of(context).pop();
},
),
),
);
}
Expand Down
12 changes: 8 additions & 4 deletions flutter_news_example/lib/home/view/home_view.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:app_ui/app_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand All @@ -24,10 +26,12 @@ class HomeView extends StatelessWidget {
previous.showLoginOverlay != current.showLoginOverlay,
listener: (context, state) {
if (state.showLoginOverlay) {
showAppModal<void>(
context: context,
builder: (context) => const LoginModal(),
routeSettings: const RouteSettings(name: LoginModal.name),
unawaited(
showAppModal<void>(
context: context,
builder: (context) => const LoginModal(),
routeSettings: const RouteSettings(name: LoginModal.name),
),
);
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ class LoginWithEmailLinkBloc
}

@override
Future<void> close() {
_incomingEmailLinksSub.cancel();
Future<void> close() async {
await _incomingEmailLinksSub.cancel();
return super.close();
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:app_ui/app_ui.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
Expand All @@ -17,9 +19,11 @@ class LoginWithEmailForm extends StatelessWidget {
return BlocListener<LoginBloc, LoginState>(
listener: (context, state) {
if (state.status.isSuccess) {
Navigator.of(
context,
).push<void>(MagicLinkPromptPage.route(email: email));
unawaited(
Navigator.of(
context,
).push<void>(MagicLinkPromptPage.route(email: email)),
);
} else if (state.status.isFailure) {
ScaffoldMessenger.of(context)
..hideCurrentSnackBar()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'dart:async';
import 'dart:developer';

import 'package:analytics_repository/analytics_repository.dart';
Expand Down Expand Up @@ -28,12 +29,16 @@ class AppBlocObserver extends BlocObserver {
void onChange(BlocBase<dynamic> bloc, Change<dynamic> change) {
super.onChange(bloc, change);
final dynamic state = change.nextState;
if (state is AnalyticsEventMixin) _analyticsRepository.track(state.event);
if (state is AnalyticsEventMixin) {
unawaited(_analyticsRepository.track(state.event));
}
}

@override
void onEvent(Bloc<dynamic, dynamic> bloc, Object? event) {
super.onEvent(bloc, event);
if (event is AnalyticsEventMixin) _analyticsRepository.track(event.event);
if (event is AnalyticsEventMixin) {
unawaited(_analyticsRepository.track(event.event));
}
}
}
2 changes: 1 addition & 1 deletion flutter_news_example/lib/main/bootstrap/bootstrap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ Future<void> bootstrap(AppBuilder builder) async {
analyticsRepository,
),
);
}, (_, __) {});
}, (_, _) {});
}
4 changes: 2 additions & 2 deletions flutter_news_example/lib/main/main_development.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import 'package:purchase_client/purchase_client.dart';
import 'package:token_storage/token_storage.dart';
import 'package:user_repository/user_repository.dart';

void main() {
bootstrap((
void main() async {
await bootstrap((
firebaseDynamicLinks,
firebaseMessaging,
sharedPreferences,
Expand Down
4 changes: 2 additions & 2 deletions flutter_news_example/lib/main/main_production.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import 'package:purchase_client/purchase_client.dart';
import 'package:token_storage/token_storage.dart';
import 'package:user_repository/user_repository.dart';

void main() {
bootstrap((
void main() async {
await bootstrap((
firebaseDynamicLinks,
firebaseMessaging,
sharedPreferences,
Expand Down
2 changes: 1 addition & 1 deletion flutter_news_example/lib/navigation/view/nav_drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import 'package:flutter_news_example/navigation/navigation.dart';
class NavDrawer extends StatelessWidget {
const NavDrawer({super.key});

static const _contentPadding = AppSpacing.lg;
static const double _contentPadding = AppSpacing.lg;

@override
Widget build(BuildContext context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class NetworkError extends StatelessWidget {
/// Route constructor to display the widget inside a [Scaffold].
static Route<void> route({VoidCallback? onRetry}) {
return PageRouteBuilder<void>(
pageBuilder: (_, __, ___) => Scaffold(
pageBuilder: (_, _, _) => Scaffold(
backgroundColor: AppColors.background,
appBar: AppBar(leading: const AppBackButton()),
body: Center(child: NetworkError(onRetry: onRetry)),
Expand Down
12 changes: 8 additions & 4 deletions flutter_news_example/lib/onboarding/view/onboarding_view.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:async';

import 'package:app_ui/app_ui.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand Down Expand Up @@ -27,10 +29,12 @@ class _OnboardingViewState extends State<OnboardingView> {
if ((state is EnablingAdTrackingSucceeded ||
state is EnablingAdTrackingFailed) &&
_controller.page != _onboardingPageTwo) {
_controller.animateToPage(
_onboardingPageTwo,
duration: _onboardingItemSwitchDuration,
curve: Curves.easeInOut,
unawaited(
_controller.animateToPage(
_onboardingPageTwo,
duration: _onboardingItemSwitchDuration,
curve: Curves.easeInOut,
),
);
} else if (state is EnablingNotificationsSucceeded) {
context.read<AppBloc>().add(const AppOnboardingCompleted());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ class SubscriptionsBloc extends Bloc<SubscriptionsEvent, SubscriptionsState> {
}

@override
Future<void> close() {
_subscriptionPurchaseUpdateSubscription.cancel();
Future<void> close() async {
await _subscriptionPurchaseUpdateSubscription.cancel();
return super.close();
}
}
Loading