Quick Tips & Notes

Short, actionable tips and code snippets for mobile development. Quick insights to boost your productivity and code quality.

Flutter Performance
1 min

Use const constructors in Flutter

Always use const constructors when possible. This helps Flutter optimize widget rebuilds and improves performance significantly. When you use `const`, Flutter can reuse the same widget instance instead of creating a new one, which reduces memory usage and improves rendering performance.
const Text('Hello World')
// Instead of
Text('Hello World')
React Native Performance
2 min

React Native FlatList optimization

Use getItemLayout, keyExtractor, and removeClippedSubviews for better FlatList performance with large datasets. These optimizations help React Native calculate layout more efficiently and remove off-screen items from memory.
<FlatList
  data={data}
  keyExtractor={(item) => item.id}
  getItemLayout={(data, index) => ({
    length: ITEM_HEIGHT,
    offset: ITEM_HEIGHT * index,
    index,
  })}
  removeClippedSubviews={true}
/>

Want More Tips?

Follow my blog for in-depth tutorials and detailed guides on mobile development.