Skip to content

Commit a9af115

Browse files
committed
lint: misc
1 parent 0e69c7b commit a9af115

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

lib/local_ads_management/bloc/archive_local_ads/archive_local_ads_bloc.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,10 @@ class ArchiveLocalAdsBloc
264264

265265
try {
266266
final updatedAd = switch (adToRestore) {
267-
LocalNativeAd ad => ad.copyWith(status: ContentStatus.active),
268-
LocalBannerAd ad => ad.copyWith(status: ContentStatus.active),
269-
LocalInterstitialAd ad => ad.copyWith(status: ContentStatus.active),
270-
LocalVideoAd ad => ad.copyWith(status: ContentStatus.active),
267+
final LocalNativeAd ad => ad.copyWith(status: ContentStatus.active),
268+
final LocalBannerAd ad => ad.copyWith(status: ContentStatus.active),
269+
final LocalInterstitialAd ad => ad.copyWith(status: ContentStatus.active),
270+
final LocalVideoAd ad => ad.copyWith(status: ContentStatus.active),
271271
_ => throw StateError(
272272
'Unknown LocalAd type: ${adToRestore.runtimeType}',
273273
),

lib/local_ads_management/view/archived_local_ads_page.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ import 'package:flutter_news_app_web_dashboard_full_source_code/local_ads_manage
99
import 'package:flutter_news_app_web_dashboard_full_source_code/local_ads_management/bloc/local_ads_management_bloc.dart'
1010
hide
1111
DeleteLocalAdForeverRequested,
12-
UndoDeleteLocalAdRequested,
13-
RestoreLocalAdRequested;
14-
import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/content_status_l10n.dart';
12+
RestoreLocalAdRequested,
13+
UndoDeleteLocalAdRequested;
1514
import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/extensions.dart';
16-
import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/string_truncate.dart';
15+
import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/local_ad_to_ad_type.dart';
1716
import 'package:intl/intl.dart';
1817
import 'package:ui_kit/ui_kit.dart';
1918

lib/local_ads_management/view/local_ads_management_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/app_localiz
88
import 'package:flutter_news_app_web_dashboard_full_source_code/l10n/l10n.dart';
99
import 'package:flutter_news_app_web_dashboard_full_source_code/local_ads_management/bloc/local_ads_management_bloc.dart';
1010
import 'package:flutter_news_app_web_dashboard_full_source_code/router/routes.dart';
11-
import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/content_status_l10n.dart'; // Added import
11+
// Added import
1212
import 'package:flutter_news_app_web_dashboard_full_source_code/shared/extensions/extensions.dart';
1313
import 'package:go_router/go_router.dart';
1414
import 'package:intl/intl.dart';
@@ -400,7 +400,7 @@ class _LocalAdsDataSource extends DataTableSource {
400400
),
401401
IconButton(
402402
icon: const Icon(Icons.edit),
403-
tooltip: l10n.edit,
403+
tooltip: l10n.editLocalAds,
404404
onPressed: () {
405405
// Navigate to edit page based on ad type
406406
switch (ad.adType) {
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
import 'package:core/core.dart';
22

3-
/// Defines extension methods for [LocalAd] to convert its `adType` string
4-
/// to the corresponding [AdType] enum.
5-
extension LocalAdToAdType on LocalAd {
6-
/// Converts the `adType` string of this [LocalAd] instance to an [AdType] enum.
3+
/// Extension on [LocalAd] to provide a convenient way to get its [AdType].
4+
extension LocalAdX on LocalAd {
5+
/// Converts the [LocalAd]'s `adType` string to an [AdType] enum value.
76
///
8-
/// Throws a [StateError] if the `adType` string does not correspond to a
9-
/// valid [AdType] enum value.
7+
/// Throws a [FormatException] if the `adType` string does not correspond
8+
/// to a valid [AdType] enum value.
109
AdType toAdType() {
1110
switch (adType) {
1211
case 'native':
@@ -18,7 +17,7 @@ extension LocalAdToAdType on LocalAd {
1817
case 'video':
1918
return AdType.video;
2019
default:
21-
throw StateError('Unknown adType: $adType');
20+
throw FormatException('Unknown AdType for LocalAd: $adType');
2221
}
2322
}
2423
}

0 commit comments

Comments
 (0)