Skip to content

Conversation

@rodrigorafaeldamaceno
Copy link
Contributor

This pull request introduces getter methods to the Command class, enhancing the clarity and readability of state checks when used in views. By encapsulating the logic for determining command states (isIdle, isRunning, isCancelled, and isSuccess) into dedicated getters, the code becomes more concise and expressive.

These changes aim to improve the developer experience by providing a cleaner and more intuitive interface for interacting with Command objects, reducing boilerplate and improving maintainability. This enhancement is particularly beneficial when building user interfaces, as it simplifies state-driven UI updates and aligns with best practices for state management in Flutter applications.

Copy link
Contributor

@wellgenio wellgenio left a comment

Choose a reason for hiding this comment

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

@rodrigorafaeldamaceno add usage examples in the README and docs

@rodrigorafaeldamaceno
Copy link
Contributor Author

@wellgenio I updated the examples in README and added isFailure getter

@wellgenio
Copy link
Contributor

@rodrigorafaeldamaceno keep the old README examples too and add the example comments:

/// Checks if the current command is running.
bool get isRunning => value is RuningCommand<T>;

@rodrigorafaeldamaceno
Copy link
Contributor Author

@wellgenio I updated the README with a Getters section

@jacobaraujo7 jacobaraujo7 merged commit 5f12e26 into Flutterando:main Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants