Database Singleton Helper class vs Package

Hello,
I have read 2 books.

  1. Real World Flutter by Tutorials (uses Hive)
  2. Flutter Apprentice (uses SQLite)

In Flutter Apprentice, the database part is managed using a Singleton Helper class whereas in Real World Flutter by Tutorials, we are using a package to initialize the database but the actual database operations are wide-spread into the other packages.

Was this decision taken considering the package based architecture used in Real World Flutter book?
Or was there any other reason that I am missing?

Or one is a preferred approach based on the database type being used?

Hi @shahil7685,
It’s a mixture of taste and the architecture used in this book. Both are valid, although the approach used in Flutter Apprentice wouldn’t fit in this codebase’s architecture.

Thanks for the question.

1 Like