Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
258 views
in Technique[技术] by (71.8m points)

dart - flutter services injection in clean architecture

I am new to clean architecture in flutter,

I know that we should inject our repositories via usecases into presenters like BLoc but I don't know how to use services like an audio service, for example we should pause, resume, seek and ... from the audioServiceImpl,

does it need a usecase for each opearation like play or we should inject the service directly into BLoc ?

question from:https://stackoverflow.com/questions/65662286/flutter-services-injection-in-clean-architecture

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You've not mentioned to the layers you've adopted from the clean architecture and the use case you need to consider such a design, so it makes your question opinion based.

A service like audio player is more a UI related thing and it does not contain business logic, as it mentioned in the clean architecture use cases layer contains application specific business rules. You should clarify how your playing file involves business logic. Although you still can use bloc for player state management.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...