Duit-Foundation / Duit-Foundation/flutter_duit

Component lifetime

Open
#248 0 comments 0 reactions 0 assignees View on GitHub
feature optimization
Dominant language
Dart
Stars
60
Forks
5
PR merge metrics
No merged PRs in 30d

Description

### Description

In the current implementation of Duit, components are registered once and, once registered, are kept in memory even though they may never be used again.

**Proposal**: implement a mechanism for a managed component life cycle.

### How it works

1. On the server side, when creating a component, you can specify its lifetime (for example, permanent or transitive)
2. When registering a component, the framework "remembers" components that should be destroyed after use and begins tracking their state.
3. When a component's widget is destroyed, a callback is called that removes the component's layout from the DuitRegistry

**It should be noted that it is not always necessary to destroy the layout when unmounting the component widget. For example, components are actively used to create ListView.builder lists, and constantly destroying and recreating components can lead to errors and decreased performance.**

Contributor guide

Open the contributing guide

Research direction

Start by reading component registration and DuitRegistry lifecycle paths, then inspect how widget destruction callbacks could trigger cleanup. Review the ListView.builder usage described in the issue to identify cases where layouts must remain reusable. Done means supporting configurable permanent or transitive lifetimes without breaking reused list components.

Written by the indexing model from the issue text.

Assessment

Tech stack
dart, flutter
Domain
mobile-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.