kevlatus/flutter_fortune_wheel

How do I get he value from the Stream?

dbdit opened this issue ยท 4 comments

dbdit commented

I'm a bit new to this, but want to get the value of the final result. What is the best way?

I'm currently using the following:

onAnimationEnd: () {
print("Value winner : " + "$selected.value");
},

Thank you for any help.

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

You "get" the value before the animation even starts.

onFling: () {
    int value = Random().nextInt(fortuneWheelItems.length);
    controller.add(value);
    print(value);
},

You don't get a value from the wheel, instead you tell the wheel which value it is supposed to show. In @tobiasht you can see the value is known before it is added to the StreamController. So you can use it from there

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.