fluttercommunity / rx_command

RxCommand - Reactive event handler wrapper class inspired by ReactiveUI. Maintainer @escamoteur
https://pub.dev/packages/rx_command
MIT License
134 stars 19 forks source link

How can I access the input parameter when the error is thrown? #42

Closed hasimyerlikaya closed 4 years ago

hasimyerlikaya commented 4 years ago

I'am big fan of RxCommand. I think best state management solution is RxVMS for flutter.

My architecture of last three project is based on RXCommand. I growup my architecture with every project.

In my last project, I use AnimatedListWidget. When user tap the delete button, I sending request to the server and then I switch widget status as loading. After server responsed, I am switch widget status to normal.

When an error thrown in RxCommand, I must change widget status to normal or error. For this, I must access TParam of RxCommand in "thrownExceptions". I will take TParam object and than switch AnimatedList item with that.

Can you add TParam in thrownExceptions return value.

image

image

escamoteur commented 4 years ago

would it be enough if I included TParam Value in CommandResults? Otherwise I would have to change to Type of thrownExeptions to some ErrorState object which would be a breaking change.

hasimyerlikaya commented 4 years ago

Frankly, I almost never felt the need to use CommandResults.

So frankly it doesn't work for me. I sent a Pull Request for an arrangement on this. If you can review that arrangement, we will not need to make this change if appropriate.

First of all I ask you to check the pull request.

escamoteur commented 4 years ago

Just for your information, in my new command package flutter_command I implemented your wish.

hasimyerlikaya commented 4 years ago

@escamoteur Thank you. I am checking flutter_command now.