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.

2 Likes

Thank you for reaching out to us with your question. We hope that the response provided by @ebueno, was helpful in addressing your concerns.

If you have any further questions or need additional assistance, please don’t hesitate to ask. Our community is here to support you!