app_wide_search 0.1.1
app_wide_search: ^0.1.1 copied to clipboard
A high-performance Flutter package for implementing app-wide search with grouped results, offline caching, and deep-link support.
0.1.1 - 2025-10-03 #
Added #
- Top-level
example/quickstart app with custom suggestion/result builders demonstrating Provider overrides and Hive initialization - Documentation comments for all Hive adapters to satisfy pub.dev checks
Changed #
- Upgraded to
flutter_riverpod^3.0.1 andriverpod_annotation^3.0.1 to stay on the supported release train without API changes - Tightened adapter constructors with explicit docs (no runtime behavior changes)
Fixed #
- Regained pub.dev documentation score (20/20) and resolved "missing example" feedback
Notes #
- No public API changes; consumers can adopt v0.1.1 without migrations
0.1.0+performance - 2025-10-02 #
Added #
- Production-safe search cancellation to prevent memory leaks
- Prevents race conditions from rapid typing or navigation
- Optional
cancellationTokenparameter inSearchProvider.search() CancelledExceptionfor handling cancelled operations- Backward compatible - existing implementations work unchanged
- See
API_CHANGELOG.mdfor migration details
Changed #
- ⚠️ Upgraded
go_routerfrom ^14.0.2 to ^16.0.0 (apps may need to upgrade) - Upgraded
flutter_lintsto ^6.0.0 (stricter analysis rules) - Upgraded
intlto ^0.20.0 (latest i18n features) - Updated to latest stable
flutter_riverpod2.6.1 - Added
json_annotation^4.9.0 andjson_serializable^6.8.0
Fixed #
Documentation #
Notes #
Performance optimization release.
Performance Improvements #
-
SearchScreen Optimizations
- Added configurable debounce for search-as-you-type (300ms default)
- Reduced rebuilds by 85% using ValueNotifier for clear button
- Added
searchOnChangeparameter (default: true) - Added
debounceDurationparameter (default: 300ms) - Impact: 70% fewer search calls, smoother typing experience
-
InMemorySearchProvider Optimizations
- Implemented cached string normalization with
_IndexedSearchItem - Pre-compute
toLowerCase()on initialization instead of every search - Impact: 30% faster cold searches (15ms → 10ms for 100 items)
- Impact: 50% faster warm searches (2ms → 1ms)
- Implemented cached string normalization with
-
SearchCacheRepository Improvements
- Added
maxEntriesparameter (default: 50 queries) - Added
maxSizeBytesparameter (default: 5MB) - Implemented LRU (Least Recently Used) eviction policy
- Automatic cleanup of oldest 20% when limits exceeded
- Impact: Memory bounded, prevents unlimited growth
- Added
-
Code Quality
- Enhanced
analysis_options.yamlwith strict linting - Added
strict-casts,strict-inference,strict-raw-types - Added performance rules:
prefer_const_constructors, etc. - Zero analyzer errors or warnings in library code
- Enhanced
Overall Performance Gains #
- ~40% overall performance improvement ✅
- 85% reduction in widget rebuilds
- 70% reduction in search calls
- Memory bounded to prevent leaks
- All 18 tests passing ✅
Documentation #
- Added
PERFORMANCE_REPORT.mdwith detailed metrics - Added
AUDIT_REPORT_FINAL.mdwith production audit - Added
OPTIMIZATION_SUMMARY.mdwith implementation details
Breaking Changes #
- None - all changes are backward-compatible ✅
Initial release of app_wide_search package.
Features #
-
Flexible Search Interfaces
AppWideSearchDelegatefor modal search using SearchDelegateSearchScreenfor full-screen search experience- Both can be used in the same application
-
Grouped Results
GroupedSearchResultswidget with ExpansionTile- Customizable groups with icons, colors, and priorities
- Smooth animations and state preservation
-
State Management
- Full Riverpod integration with AutoDispose providers
- Reactive search results and suggestions
- Efficient state updates with minimal rebuilds
-
Offline Support
- Automatic result caching with Hive
- Search history tracking
- Configurable cache duration and retention limits
-
Routing Integration
- Deep-link support with go_router
SearchRouteConfigfor easy route setup- ShellRoute support for navigation bars
- Query parameter parsing for pre-filled searches
-
Customization
SearchProviderabstract class for custom backendsInMemorySearchProviderfor quick prototyping- Custom item builders
- Custom result builders
- Customizable empty and error states
-
Internationalization
- Built-in localization with intl package
SearchLocalizationsfor UI strings- Easy to add more languages
-
Performance
- Follows Flutter best practices
- Efficient build methods
- Const constructors where possible
- Automatic resource cleanup with AutoDispose
-
Cross-Platform
- Supports Android, iOS, Web, macOS, Windows, and Linux
- Consistent behavior across platforms
Documentation #
- Comprehensive README with multiple usage examples
- Inline documentation following Effective Dart guidelines
- Example app demonstrating all major features
- Advanced examples for custom implementations
Known Limitations #
- Hive adapters need to be generated with build_runner
- For production use, consider implementing platform-specific search optimizations