runable
This commit is contained in:
69
lib/core/performance.dart
Normal file
69
lib/core/performance.dart
Normal file
@@ -0,0 +1,69 @@
|
||||
/// Performance optimization utilities - Export file
|
||||
///
|
||||
/// This file provides easy access to all performance optimization utilities.
|
||||
/// Import this single file to get access to all performance features.
|
||||
///
|
||||
/// Usage:
|
||||
/// ```dart
|
||||
/// import 'package:retail/core/performance.dart';
|
||||
/// ```
|
||||
|
||||
// Image Caching
|
||||
export 'config/image_cache_config.dart';
|
||||
|
||||
// Performance Constants
|
||||
export 'constants/performance_constants.dart';
|
||||
|
||||
// Utilities
|
||||
export 'utils/debouncer.dart';
|
||||
export 'utils/database_optimizer.dart';
|
||||
export 'utils/performance_monitor.dart';
|
||||
// Note: provider_optimization.dart archived - use Riverpod's built-in .select() instead
|
||||
export 'utils/responsive_helper.dart';
|
||||
|
||||
// Optimized Widgets
|
||||
export 'widgets/optimized_cached_image.dart';
|
||||
export 'widgets/optimized_grid_view.dart';
|
||||
export 'widgets/optimized_list_view.dart';
|
||||
|
||||
/// Quick Start Guide:
|
||||
///
|
||||
/// 1. Image Optimization:
|
||||
/// ```dart
|
||||
/// ProductGridImage(imageUrl: url, size: 150)
|
||||
/// ```
|
||||
///
|
||||
/// 2. Grid Optimization:
|
||||
/// ```dart
|
||||
/// ProductGridView(products: products, itemBuilder: ...)
|
||||
/// ```
|
||||
///
|
||||
/// 3. State Optimization:
|
||||
/// ```dart
|
||||
/// final name = ref.watchField(provider, (state) => state.name)
|
||||
/// ```
|
||||
///
|
||||
/// 4. Database Optimization:
|
||||
/// ```dart
|
||||
/// await DatabaseOptimizer.batchWrite(box, items)
|
||||
/// ```
|
||||
///
|
||||
/// 5. Search Debouncing:
|
||||
/// ```dart
|
||||
/// final searchDebouncer = SearchDebouncer();
|
||||
/// searchDebouncer.run(() => search(query));
|
||||
/// ```
|
||||
///
|
||||
/// 6. Performance Monitoring:
|
||||
/// ```dart
|
||||
/// await PerformanceMonitor().trackAsync('operation', () async {...});
|
||||
/// PerformanceMonitor().printSummary();
|
||||
/// ```
|
||||
///
|
||||
/// 7. Responsive Helpers:
|
||||
/// ```dart
|
||||
/// if (context.isMobile) { ... }
|
||||
/// final columns = context.gridColumns;
|
||||
/// ```
|
||||
///
|
||||
/// See PERFORMANCE_GUIDE.md for complete documentation.
|
||||
Reference in New Issue
Block a user