Comments (3)
You don't need that then.
Instead of injecting ProductsPagingSourceByCoroutine
in RepositoryModule
, inject what we have in ProductsPagingSourceByCoroutine
as the parameter (which is ProductsApi
).
from mvvmtemplate.
can you please follow up with me in your example , so this is how it would look like
class ProductsListRepositoryImpl @Inject constructor( private val productsApi: ProductsApi ) : ProductsListRepository { override fun getBeersListByCoroutine(ids: String): Flow<PagingData<Beer>> = productsApi.getBeersListByCoroutine(position) .map { BeerMapper().mapLeftToRight(it) } }
Doing that will cause the following error
Suspend function 'getCountriesList' should be called only from a coroutine or another suspend function
can you please help me to fix that so I can move forward. I don't want to just do what android studio suggest without understanding.
from mvvmtemplate.
That means you need a coroutine builder:
X.launch {
HERE
Which X
could be lifecycleScope, lifecycle.coroutineScope, viewLifecycleOwner.lifecycleScope
for Activity/Fragment, viewModelScope
for ViewModel, ...; Which are tied up with their lifecycles.
from mvvmtemplate.
Related Issues (14)
- Hi i am following your template based on MVVM, But i was confused in how to forward data from view to data layer. would you please explain with login example? HOT 6
- Are you planning to add persistence feature? HOT 1
- How to include a foreground location service with this architecture?
- What is the best way to implement a use case that doesn't have any params? HOT 1
- [BUG]: JAVA_HOME is not set. HOT 5
- I am unable to inject main activity in base fragment HOT 1
- [BUG]: Title goes here HOT 1
- [BUG]: Title goes here HOT 1
- [BUG]: Showing the loading animation on the loaded list
- Could not clone: Drjacky/MVVMTemplate is not a template repository. HOT 2
- Memory leak HOT 3
- Empty screen instead of no internet connection view HOT 3
- [BUG]: Showing no internet screen after rotation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mvvmtemplate.