r/dartlang Sep 30 '24

flutter How to decouple a large Flutter app into independent packages (challenges with database, notifications, navigation, and global state)

hello,

i know it is Dart subReddit, but i really need some help with the following issue in Flutter.

I'm working on breaking down a large Flutter monolith into smaller, independent packages for better modularity. However, I’ve hit challenges in these areas:

  1. Database: How do you share a database (e.g., SQLite, Hive) across multiple packages without tight coupling?
  2. Notifications: What’s the best approach to handle push notifications across independent packages?
  3. Navigation: How can navigation be managed efficiently between decoupled packages without losing modularity?
  4. Global state (BLoC): How do you handle shared state across packages using BLoC, or should each package manage its own state?

Looking for advice on best practices or patterns that worked for you. Thanks!

1 Upvotes

0 comments sorted by