Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(flutter_todos): add close to TodosApi #4157

Merged
merged 4 commits into from
Apr 27, 2024

Conversation

felangel
Copy link
Owner

Status

READY

Breaking Changes

NO

Description

Even though the lifetime of the TodosApi instance is tied to the application in this case, it's still valuable to add a close API to the interface since the TodosApi should expose a way to close the instance and free any allocated resources. (closes #4154)

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@felangel felangel added example Example application refactor Refactor an existing implementation labels Apr 27, 2024
@felangel felangel self-assigned this Apr 27, 2024
@@ -19,7 +19,9 @@ class LocalStorageTodosApi extends TodosApi {

final SharedPreferences _plugin;

final _todoStreamController = BehaviorSubject<List<Todo>>.seeded(const []);
late final _todoStreamController = BehaviorSubject<List<Todo>>.seeded(
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this late so that the BehaviorSubject is instantiated lazily.

@felangel felangel merged commit 8bb8dc9 into master Apr 27, 2024
9 checks passed
@felangel felangel deleted the refactor/todos-add-close branch April 27, 2024 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
example Example application refactor Refactor an existing implementation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

question: [flutter_todos] why don't close StreamController?
1 participant