-
Notifications
You must be signed in to change notification settings - Fork 0
flutter: FamilySettings — fix analyzer (unawaited + toJson) #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…nce.share with ShareParams; add cross_file import
…nd leftover stub; fix const usage; migrate invite dialog share to SharePlus.instance
…/locals; capture messenger in batch dialogs; restore RightClickCopy with post-await safety; tidy comments
…action); batch_operation_bar context-safety ignores
…res; tidy image_utils comment
…ics to BalancePoint/dynamic/Transaction
… add intl import; doc _getCurrencySymbol; tidy source_badge
…rencySymbol; no behavior change
…ustomThemeEditor pre-captured messenger/navigator; QR uses eyeStyle/dataModuleStyle; AccountList uses AccountCard.fromAccount
…used groupedAccounts; const-safe padding in SecondaryButton
…e type infos; keep UI enums for grouping visuals
…SubType and adapt mapping; use AccountCard.fromAccount everywhere
…olve prefixed enum typos
…pe; correct adapters to model.AccountType mapping
…um declarations to satisfy analyzer
…ing in SecondaryButton
…oan => liability; others => asset) and total filter by matcher
…s); keep _doShare hook for tests; replace final Share.share usage in ShareDialog
…e annotations, remove unused locals warnings)
…d() to fix use_of_void_result; add dart:async import
…awaited(_syncToServer()) in forceSync
…ilySettings; analyzer clean
Summary of ChangesHello @zensgit, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on enhancing code quality and addressing analyzer warnings across the Flutter application. The primary goal was to ensure proper handling of asynchronous operations, particularly within the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes Flutter analyzer warnings related to unawaited futures and incorrect toJson usage in FamilySettings. The main focus is on wrapping background sync operations with unawaited() calls and passing Map data via toJson() to updateFamilySettings.
- Wraps background sync calls with unawaited() to silence analyzer warnings about unhandled futures
- Fixes toJson() usage in updateFamilySettings API call to pass Map instead of object
- Removes unused variables and imports to clean up analyzer warnings
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| jive-flutter/lib/services/family_settings_service.dart | Adds unawaited() wrapper for background sync calls and fixes toJson() usage |
| jive-flutter/lib/widgets/source_badge.dart | Removes unused colorScheme variable |
| jive-flutter/lib/ui/components/transactions/transaction_list.dart | Removes unused currency_provider import |
| jive-flutter/lib/ui/components/loading/loading_widget.dart | Removes unused theme variable |
| jive-flutter/lib/core/network/interceptors/retry_interceptor.dart | Removes unused _lastGlobalFailure variable |
| jive-flutter/lib/widgets/custom_theme_editor.dart | Adds use_build_context_synchronously ignore comments |
| jive-flutter/lib/widgets/common/right_click_copy.dart | Refactors to avoid use_build_context_synchronously warnings |
| jive-flutter/lib/widgets/batch_operation_bar.dart | Captures context references before async operations |
| jive-flutter/lib/services/share_service.dart | Adds context handling and unused variable ignore comments |
| jive-flutter/lib/ui/components/dashboard/dashboard_overview.dart | Updates type references and removes unused import |
| jive-flutter/lib/ui/components/cards/account_card.dart | Removes unused currency formatting method |
| jive-flutter/lib/ui/components/accounts/account_list.dart | Adds account type mapping functions |
| jive-flutter/lib/widgets/qr_code_generator.dart | Updates QR code styling properties |
| jive-flutter/lib/ui/components/buttons/secondary_button.dart | Adds const to EdgeInsets constructor |
| jive-flutter/lib/ui/components/budget/budget_progress.dart | Converts to ConsumerWidget and removes const |
| jive-flutter/lib/ui/components/dashboard/account_overview.dart | Comments out unused groupedAccounts variable |
| jive-flutter/lib/utils/image_utils.dart | Removes unused image extension validation code |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| ]; | ||
|
|
||
| // Allow URLs without extensions (many CDNs don't use them) | ||
| // Check for common image extensions// Allow URLs without extensions (many CDNs don't use them) |
Copilot
AI
Sep 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing space between comments. Should be '// Check for common image extensions // Allow URLs without extensions (many CDNs don't use them)'
| // Check for common image extensions// Allow URLs without extensions (many CDNs don't use them) | |
| // Check for common image extensions | |
| // Allow URLs without extensions (many CDNs don't use them) |
Copilot uses AI. Check for mistakes.
| /// 强制同步 | ||
| Future<void> forceSync() async { | ||
| await _syncToServer(); | ||
| unawaited(_syncToServer()); |
Copilot
AI
Sep 30, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The forceSync() method should await the sync operation rather than making it unawaited, as users calling forceSync() likely expect synchronous completion.
| unawaited(_syncToServer()); | |
| await _syncToServer(); |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request focuses on addressing analyzer warnings, primarily unawaited_futures and type issues. The changes are generally good cleanups. However, I've identified a couple of areas for improvement. One change in forceSync alters its behavior from an awaited call to fire-and-forget, which could be misleading and cause issues for callers. Another change introduces List<dynamic>, which sacrifices type safety. My review includes suggestions to address these points to improve code correctness and maintainability.
| /// 强制同步 | ||
| Future<void> forceSync() async { | ||
| await _syncToServer(); | ||
| unawaited(_syncToServer()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using unawaited here changes the behavior of forceSync. Previously, it would wait for _syncToServer() to complete. Now, it returns immediately, making it a fire-and-forget call. This can be misleading for callers who await forceSync() expecting the synchronization to be finished. This could lead to race conditions. If the intent is for this to be awaited, await should be used. If it's meant to be fire-and-forget, consider renaming the method to something like triggerForceSync() to make its behavior clear.
| unawaited(_syncToServer()); | |
| await _syncToServer(); |
| final List<QuickActionData> quickActions; | ||
| final List<TransactionData> recentTransactions; | ||
| final List<BalancePoint> balanceData; | ||
| final List<dynamic> quickActions; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type of quickActions has been changed to List<dynamic>. Using dynamic should be avoided as it bypasses static type checking, which can lead to runtime errors and makes the code harder to maintain. It's better to use a specific type. If you need to support different types of quick actions, consider using a common base class or a sealed class to model the different action types.
| final List<dynamic> quickActions; | |
| final List<QuickActionData> quickActions; |
Validation: analyzer OK for changes; tests green locally