Paulina Szklarska
1 min readJan 15, 2019

--

Hi!

My approach to refresh data on button tap (or pull-to-refresh action) would be very similar to what you did in your repository.

So whenever there’s some action, you’re subscribing yourself to observe state from viewModel just to trigger data refresh, and it’ll be the same ViewModel instance. There’s no need to create another instance of ViewModel, as the idea is to have only one ViewModel, even if Activity is recreated.

I hope it’s clear for you, thanks for the comment!

--

--

Paulina Szklarska
Paulina Szklarska

Written by Paulina Szklarska

Flutter GDE / Flutter & Android Developer / blogger / speaker / cat owner / travel enthusiast

Responses (1)