Impeller Rendering Engine
Flutter’s Impeller rendering engine provides hardware-accelerated graphics on iOS and Android. Wonderous is designed to take advantage of Impeller’s performance benefits:- Precompiled shaders: Reduces runtime shader compilation stutters
- Metal/Vulkan backends: Direct access to GPU for faster rendering
- Consistent frame times: Eliminates first-frame jank
Impeller is enabled by default in Flutter 3.10+ on iOS and gradually rolling out for Android. The app runs smoothly on both the legacy renderer and Impeller.
High Refresh Rate with FlutterDisplayMode
On Android devices that support high refresh rates (90Hz, 120Hz, 144Hz), the app automatically sets the display to the maximum available refresh rate:Benefits
- Smoother animations and transitions
- More responsive touch interactions
- Enhanced visual experience on capable devices
Image Caching Strategy
Wonderous implements a custom image cache configuration to handle the large number of high-resolution images in the app.AppImageCache Configuration
- Wonder illustration layers (foreground, background, sun/moon)
- Photo gallery images
- Artifact search results
- Timeline event images
Cache Lifecycle
Flutter’s image cache uses an LRU (Least Recently Used) strategy:- Images are cached when first loaded
- When cache reaches maximum size, least recently used images are evicted
- Cache persists for the app’s lifetime but not between sessions
Precaching Strategies
Wonderous uses strategic precaching to minimize loading delays during user interactions.Web-Specific Precaching
On web, images must be explicitly precached to avoid flashing during navigation:Icon Precaching
Wonder Image Precaching
WASM Deployment
Wonderous can be deployed as a WebAssembly (WASM) application for improved web performance:Building for WASM
WASM Benefits
- Faster execution: Near-native performance for Dart code
- Smaller bundle size: More efficient code representation
- Better optimization: Ahead-of-time compilation benefits
- Improved startup time: Faster initialization compared to JavaScript
Browser Support
WASM requires modern browsers with WebAssembly support:- Chrome 87+
- Firefox 89+
- Safari 15+
- Edge 87+
Older browsers will fall back to the JavaScript build automatically if WASM is not supported.
Animation Performance
Wonderous usesflutter_animate for performant, declarative animations.
Default Animation Duration
Disabling Animations
Scroll Performance
Custom Scroll Behavior
Bouncing Physics
Layout Performance
Lazy Loading
Wonderous uses lazy loading patterns to defer expensive widget builds:LazyIndexedStackfor tab viewsListView.builderfor scrollable lists- Conditional rendering based on viewport visibility
Responsive Scaling
Build Optimization
Production Builds
For optimal performance, always use release mode for production:Key Optimizations in Release Mode
- Tree shaking removes unused code
- Minification reduces bundle size
- Obfuscation improves code security
- Ahead-of-time compilation for native performance
Performance Monitoring
While developing, use Flutter DevTools to monitor:- Frame rendering time: Should stay under 16ms (60fps)
- Widget rebuild counts: Minimize unnecessary rebuilds
- Memory usage: Watch for memory leaks
- Network performance: Monitor API calls and image loading
Best Practices
- Precache critical assets: Reduce first-frame jank by preloading important images
- Use const constructors: Allow Flutter to reuse widget instances
- Avoid expensive builds: Move computation out of build methods
- Leverage image cache: Configure appropriate cache size for your app’s needs
- Test on real devices: Emulators/simulators don’t reflect actual performance
- Profile before optimizing: Use Flutter DevTools to identify actual bottlenecks