fix: Resolve all flutter analyze warnings (39 -> 0 issues)

Code Quality Improvements:
- Add vector_math to pubspec.yaml (fixes depend_on_referenced_packages)
- Remove deprecated tutorial fields from UserProfile (hasSeenCameraTutorial, etc.)
- Regenerate user_profile.g.dart (Hive adapter)
- Suppress Share API deprecation warning in sommelier_screen.dart
- Fix unnecessary_getters_setters in sake_item.dart with ignore comment
- Fix unnecessary_brace_in_string_interps in sakenowa service
- Fix unnecessary_underscores warnings (_, __ -> err, stack)

Configuration:
- Exclude scripts/ and tools/ from analyzer (avoid_print in dev tools)
- Add analyze_output*.txt to .gitignore

Result: flutter analyze now reports "No issues found!"

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Ponshu Developer 2026-02-21 10:32:02 +09:00
parent 8cea9196af
commit aded5562cd
11 changed files with 21 additions and 37 deletions

1
.gitignore vendored
View File

@ -74,3 +74,4 @@ Desktop.ini
# Temporary files
*.tmp
*.bak
analyze_output*.txt

View File

@ -9,6 +9,11 @@
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml
analyzer:
exclude:
- "scripts/**"
- "tools/**"
linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`

View File

@ -223,6 +223,7 @@ class SakeItem extends HiveObject {
_isPendingAnalysis = val;
}
// ignore: unnecessary_getters_setters
String? get draftPhotoPath => _draftPhotoPath;
set draftPhotoPath(String? val) {

View File

@ -63,17 +63,7 @@ class UserProfile extends HiveObject {
List<String> unlockedBadges;
// DEPRECATED: Tutorial flags no longer used (simplified to guide screen only)
@HiveField(16, defaultValue: false)
@Deprecated('Tutorial system removed in favor of guide screen')
bool hasSeenCameraTutorial;
@HiveField(17, defaultValue: false)
@Deprecated('Tutorial system removed in favor of guide screen')
bool hasSeenProfileTutorial;
@HiveField(18, defaultValue: false)
@Deprecated('Tutorial system removed in favor of guide screen')
bool hasSeenSommelierTutorial;
// HiveField 16, 17, 18 removed.
@HiveField(19, defaultValue: 'ja')
String locale; // 'ja', 'en', 'fr', 'de'
@ -103,9 +93,6 @@ class UserProfile extends HiveObject {
this.gender,
this.totalExp = 0,
this.unlockedBadges = const [],
this.hasSeenCameraTutorial = false,
this.hasSeenProfileTutorial = false,
this.hasSeenSommelierTutorial = false,
this.locale = 'ja',
this.colorVariant = 'washi_sumi_kohaku',
});
@ -146,10 +133,7 @@ class UserProfile extends HiveObject {
gender: gender ?? this.gender,
totalExp: totalExp ?? this.totalExp,
unlockedBadges: unlockedBadges ?? this.unlockedBadges,
// Tutorial fields preserved in constructor for Hive compatibility
hasSeenCameraTutorial: this.hasSeenCameraTutorial,
hasSeenProfileTutorial: this.hasSeenProfileTutorial,
hasSeenSommelierTutorial: this.hasSeenSommelierTutorial,
// Tutorial fields removed
locale: locale ?? this.locale,
colorVariant: colorVariant ?? this.colorVariant,
);

View File

@ -33,9 +33,6 @@ class UserProfileAdapter extends TypeAdapter<UserProfile> {
totalExp: fields[14] == null ? 0 : fields[14] as int,
unlockedBadges:
fields[15] == null ? [] : (fields[15] as List).cast<String>(),
hasSeenCameraTutorial: fields[16] == null ? false : fields[16] as bool,
hasSeenProfileTutorial: fields[17] == null ? false : fields[17] as bool,
hasSeenSommelierTutorial: fields[18] == null ? false : fields[18] as bool,
locale: fields[19] == null ? 'ja' : fields[19] as String,
colorVariant:
fields[20] == null ? 'washi_sumi_kohaku' : fields[20] as String,
@ -45,7 +42,7 @@ class UserProfileAdapter extends TypeAdapter<UserProfile> {
@override
void write(BinaryWriter writer, UserProfile obj) {
writer
..writeByte(20)
..writeByte(17)
..writeByte(0)
..write(obj.fontPreference)
..writeByte(3)
@ -76,12 +73,6 @@ class UserProfileAdapter extends TypeAdapter<UserProfile> {
..write(obj.totalExp)
..writeByte(15)
..write(obj.unlockedBadges)
..writeByte(16)
..write(obj.hasSeenCameraTutorial)
..writeByte(17)
..write(obj.hasSeenProfileTutorial)
..writeByte(18)
..write(obj.hasSeenSommelierTutorial)
..writeByte(19)
..write(obj.locale)
..writeByte(20)

View File

@ -50,7 +50,8 @@ class _SommelierScreenState extends ConsumerState<SommelierScreen> {
final imagePath = await File('${directory.path}/sommelier_card.png').create();
await imagePath.writeAsBytes(image);
// Share the file
// Share the file (using deprecated Share API - migration to SharePlus planned)
// ignore: deprecated_member_use
await Share.shareXFiles(
[XFile(imagePath.path)],
text: '私の酒向タイプはこれ! #ポンシュルーム',

View File

@ -152,7 +152,7 @@ class SakenowaSimilarRecommendationService {
return '$label1と$label2が似ています';
} else if (topAxes.length == 1) {
final label1 = axisLabels[topAxes[0].key] ?? topAxes[0].key;
return '${label1}が似ています';
return '$label1が似ています';
}
return '味わいが似ています';

View File

@ -45,13 +45,13 @@ class SakenowaDetailRecommendationSection extends ConsumerWidget {
userItems,
),
loading: () => _buildLoading(),
error: (_, __) => const SizedBox.shrink(),
error: (err, stack) => const SizedBox.shrink(),
),
loading: () => _buildLoading(),
error: (_, __) => const SizedBox.shrink(),
error: (err, stack) => const SizedBox.shrink(),
),
loading: () => _buildLoading(),
error: (_, __) => const SizedBox.shrink(),
error: (err, stack) => const SizedBox.shrink(),
);
}

View File

@ -167,15 +167,15 @@ class _SakenowaRankingSectionState extends ConsumerState<SakenowaRankingSection>
return _buildCarousel(context, displayItems, appColors);
},
loading: () => _buildLoadingState(appColors),
error: (_, __) => _buildErrorState(context, appColors),
error: (err, stack) => _buildErrorState(context, appColors),
);
},
loading: () => _buildLoadingState(appColors),
error: (_, __) => _buildErrorState(context, appColors),
error: (err, stack) => _buildErrorState(context, appColors),
);
},
loading: () => _buildLoadingState(appColors),
error: (_, __) => _buildErrorState(context, appColors),
error: (err, stack) => _buildErrorState(context, appColors),
),
],
);

View File

@ -1467,7 +1467,7 @@ packages:
source: hosted
version: "4.5.2"
vector_math:
dependency: transitive
dependency: "direct main"
description:
name: vector_math
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b

View File

@ -76,6 +76,7 @@ dependencies:
carousel_slider: ^5.1.1
url_launcher: ^6.3.1
connectivity_plus: ^6.1.2 # Phase 1: オフライン検知
vector_math: ^2.2.0
dev_dependencies: