Skip to content

Commit b52e429

Browse files
committed
Fix analyzer issues and code quality problems
1 parent 79a412b commit b52e429

File tree

19 files changed

+116
-63
lines changed

19 files changed

+116
-63
lines changed

analysis-results.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
[warning] Dead code (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/data/repositories/movie_repository_impl.dart:81:36)
2+
[warning] The left operand can't be null, so the right operand is never executed (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/data/repositories/movie_repository_impl.dart:81:39)
3+
[warning] The left operand can't be null, so the right operand is never executed (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/data/repositories/movie_repository_impl.dart:82:41)
4+
[warning] The left operand can't be null, so the right operand is never executed (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/data/repositories/movie_repository_impl.dart:83:41)
5+
[warning] The left operand can't be null, so the right operand is never executed (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/data/repositories/movie_repository_impl.dart:84:33)
6+
[info] The member 'getArtistAllMovies' overrides an inherited member but isn't annotated with '@override' (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/data/repositories/movie_repository_impl.dart:145:23)
7+
[warning] Dead code (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/artist_detail_page.dart:162:59)
8+
[warning] The left operand can't be null, so the right operand is never executed (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/artist_detail_page.dart:162:62)
9+
[warning] The left operand can't be null, so the right operand is never executed (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/artist_detail_page.dart:177:52)
10+
[warning] The left operand can't be null, so the right operand is never executed (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/artist_detail_page.dart:192:56)
11+
[warning] The left operand can't be null, so the right operand is never executed (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/artist_detail_page.dart:215:43)
12+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/artist_detail_page.dart:318:39)
13+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/artist_detail_page.dart:339:49)
14+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/artist_detail_page.dart:339:53)
15+
[error] Local variable 'imageUrl' can't be referenced before it is declared (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/movie_detail_page.dart:474:27)
16+
[info] 'withOpacity' is deprecated and shouldn't be used. Use .withValues() to avoid precision loss (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/movie_detail_page.dart:179:61)
17+
[info] 'withOpacity' is deprecated and shouldn't be used. Use .withValues() to avoid precision loss (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/movie_detail_page.dart:210:41)
18+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/movie_detail_page.dart:220:41)
19+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/movie_detail_page.dart:220:45)
20+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/movie_detail_page.dart:389:39)
21+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/movie_detail_page.dart:402:49)
22+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/movie_detail_page.dart:402:53)
23+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/movie_detail_page.dart:470:39)
24+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/movie_detail_page.dart:494:55)
25+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/movie/presentation/pages/movie_detail_page.dart:494:59)
26+
[error] Local variable 'imageUrl' can't be referenced before it is declared (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/tv_series/presentation/pages/tv_series_detail_page.dart:494:27)
27+
[info] 'withOpacity' is deprecated and shouldn't be used. Use .withValues() to avoid precision loss (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/tv_series/presentation/pages/tv_series_detail_page.dart:184:61)
28+
[info] 'withOpacity' is deprecated and shouldn't be used. Use .withValues() to avoid precision loss (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/tv_series/presentation/pages/tv_series_detail_page.dart:215:41)
29+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/tv_series/presentation/pages/tv_series_detail_page.dart:225:41)
30+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/tv_series/presentation/pages/tv_series_detail_page.dart:225:45)
31+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/tv_series/presentation/pages/tv_series_detail_page.dart:409:39)
32+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/tv_series/presentation/pages/tv_series_detail_page.dart:422:49)
33+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/tv_series/presentation/pages/tv_series_detail_page.dart:422:53)
34+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/tv_series/presentation/pages/tv_series_detail_page.dart:490:39)
35+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/tv_series/presentation/pages/tv_series_detail_page.dart:512:55)
36+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/tv_series/presentation/pages/tv_series_detail_page.dart:512:59)
37+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/favorites/favorites_page.dart:133:55)
38+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/features/favorites/favorites_page.dart:133:59)
39+
[info] Unnecessary use of multiple underscores (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/routing/app_router.dart:9:37)
40+
[warning] Dead code (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/presentation/widgets/universal_search.dart:35:39)
41+
[warning] Dead code (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/presentation/widgets/universal_search.dart:64:42)
42+
[warning] Dead code (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/presentation/widgets/universal_search.dart:94:40)
43+
[warning] The left operand can't be null, so the right operand is never executed (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/presentation/widgets/universal_search.dart:35:42)
44+
[warning] The left operand can't be null, so the right operand is never executed (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/presentation/widgets/universal_search.dart:36:37)
45+
[warning] The left operand can't be null, so the right operand is never executed (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/presentation/widgets/universal_search.dart:64:45)
46+
[warning] The left operand can't be null, so the right operand is never executed (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/presentation/widgets/universal_search.dart:66:34)
47+
[warning] The left operand can't be null, so the right operand is never executed (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/presentation/widgets/universal_search.dart:94:43)
48+
[warning] The left operand can't be null, so the right operand is never executed (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/presentation/widgets/universal_search.dart:95:37)
49+
[info] 'withOpacity' is deprecated and shouldn't be used. Use .withValues() to avoid precision loss (/Users/mehedihassanpiash/Documents/RandD/flutter_movie_clean_architecture/lib/presentation/widgets/universal_search.dart:225:37)

analysis_options.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,9 @@ linter:
2424
# avoid_print: false # Uncomment to disable the `avoid_print` rule
2525
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
2626

27+
analyzer:
28+
errors:
29+
invalid_annotation_target: ignore
30+
2731
# Additional information about this file can be found at
2832
# https://dart.dev/guides/language/analysis-options

lib/core/config/app_constant.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
const BASE_URL = "https://api.themoviedb.org/3/";
2-
const API_KEY = "59cd6896d8432f9c69aed9b86b9c2931";
3-
const IMAGE_URL = "https://image.tmdb.org/t/p/w342/";
1+
const baseUrl = "https://api.themoviedb.org/3/";
2+
const apiKey = "59cd6896d8432f9c69aed9b86b9c2931";
3+
const imageUrl = "https://image.tmdb.org/t/p/w342/";

lib/core/network/dio_provider.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import 'package:pretty_dio_logger/pretty_dio_logger.dart';
55

66
final dioProvider = Provider<Dio>((ref) {
77
final dio = Dio(
8-
BaseOptions(baseUrl: BASE_URL, queryParameters: {'api_key': API_KEY}),
8+
BaseOptions(baseUrl: baseUrl, queryParameters: {'api_key': apiKey}),
99
);
1010
dio.interceptors.add(
1111
PrettyDioLogger(

lib/features/celebrity/presentation/widgets/person_card.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class PersonCardWidget extends StatelessWidget {
2222
borderRadius: BorderRadius.circular(12),
2323
child: person.profilePath != null
2424
? CachedNetworkImage(
25-
imageUrl: '$IMAGE_URL${person.profilePath}',
25+
imageUrl: '$imageUrl${person.profilePath}',
2626
fit: BoxFit.cover,
2727
errorWidget: (context, url, error) => Container(
2828
color: Colors.grey[300],

lib/features/favorites/favorites_page.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,10 @@ class _FavoritesPageState extends State<FavoritesPage> {
127127
),
128128
child: favorite.posterPath.isNotEmpty
129129
? Image.network(
130-
'$IMAGE_URL${favorite.posterPath}',
130+
'$imageUrl${favorite.posterPath}',
131131
fit: BoxFit.cover,
132132
width: double.infinity,
133-
errorBuilder: (_, __, ___) =>
133+
errorBuilder: (context, error, stackTrace) =>
134134
_buildPlaceholderImage(),
135135
)
136136
: _buildPlaceholderImage(),

lib/features/movie/data/models/movie_detail_model.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ class MovieDetailModel with _$MovieDetailModel {
99
required int id,
1010
required String title,
1111
required String overview,
12-
@JsonKey(name: 'poster_path') required String posterPath,
13-
@JsonKey(name: 'release_date') required String releaseDate,
14-
@JsonKey(name: 'vote_average') required double voteAverage,
15-
required int runtime,
12+
@JsonKey(name: 'poster_path') String? posterPath,
13+
@JsonKey(name: 'release_date') String? releaseDate,
14+
@JsonKey(name: 'vote_average') double? voteAverage,
15+
int? runtime,
1616
@JsonKey(name: 'original_language') String? originalLanguage,
1717
List<Genre>? genres,
1818
@JsonKey(name: 'production_companies')

lib/features/movie/data/repositories/movie_repository_impl.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ class MovieRepositoryImpl implements MovieRepository {
142142
);
143143
}
144144

145+
@override
145146
Future<CreditModel> getArtistAllMovies(int artistId) async {
146147
final model = await remoteDataSource.getArtistAllMovies(artistId);
147148
return CreditModel(id: model.id, cast: model.cast, crew: model.crew);

lib/features/movie/domain/repositories/usecases/get_movie_detail.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import 'package:flutter_movie_clean_architecture/features/movie/domain/entities/movie.dart';
21
import 'package:flutter_movie_clean_architecture/features/movie/domain/entities/movie_detail.dart';
32
import 'package:flutter_movie_clean_architecture/features/movie/domain/repositories/entities/movie_repository.dart';
43

lib/features/movie/presentation/pages/artist_detail_page.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class _ArtistDetailPageState extends ConsumerState<ArtistDetailPage> {
120120
image: artist.profilePath != null
121121
? DecorationImage(
122122
image: NetworkImage(
123-
"$IMAGE_URL${artist.profilePath}",
123+
"$imageUrl${artist.profilePath}",
124124
),
125125
fit: BoxFit.cover,
126126
)
@@ -159,7 +159,7 @@ class _ArtistDetailPageState extends ConsumerState<ArtistDetailPage> {
159159
),
160160
),
161161
Text(
162-
artist.knownForDepartment ?? 'Acting',
162+
artist.knownForDepartment,
163163
style: const TextStyle(
164164
fontSize: 16,
165165
color: Colors.black87,
@@ -174,7 +174,7 @@ class _ArtistDetailPageState extends ConsumerState<ArtistDetailPage> {
174174
),
175175
),
176176
Text(
177-
artist.birthday ?? 'N/A',
177+
artist.birthday,
178178
style: const TextStyle(
179179
fontSize: 16,
180180
color: Colors.black87,
@@ -189,7 +189,7 @@ class _ArtistDetailPageState extends ConsumerState<ArtistDetailPage> {
189189
),
190190
),
191191
Text(
192-
artist.placeOfBirth ?? 'N/A',
192+
artist.placeOfBirth,
193193
style: const TextStyle(
194194
fontSize: 16,
195195
color: Colors.black87,
@@ -212,7 +212,7 @@ class _ArtistDetailPageState extends ConsumerState<ArtistDetailPage> {
212212
),
213213
const SizedBox(height: 12),
214214
Text(
215-
artist.biography ?? 'No biography available.',
215+
artist.biography,
216216
maxLines: _isExpanded ? null : 4,
217217
overflow: _isExpanded
218218
? TextOverflow.visible
@@ -315,7 +315,7 @@ class ArtistMoviesSection extends StatelessWidget {
315315
child: ListView.separated(
316316
scrollDirection: Axis.horizontal,
317317
itemCount: movies.length,
318-
separatorBuilder: (_, __) => const SizedBox(width: 12),
318+
separatorBuilder: (context, index) => const SizedBox(width: 12),
319319
itemBuilder: (context, index) {
320320
final item = movies[index];
321321
return GestureDetector(
@@ -332,11 +332,11 @@ class ArtistMoviesSection extends StatelessWidget {
332332
borderRadius: BorderRadius.circular(12),
333333
child: item.posterPath != null
334334
? Image.network(
335-
'$IMAGE_URL${item.posterPath}',
335+
'$imageUrl${item.posterPath}',
336336
width: 110,
337337
height: 160,
338338
fit: BoxFit.cover,
339-
errorBuilder: (_, __, ___) => _errorPlaceholder(),
339+
errorBuilder: (context, error, stackTrace) => _errorPlaceholder(),
340340
)
341341
: _errorPlaceholder(),
342342
),

0 commit comments

Comments
 (0)