Relative Content

Tag Archive for flutterclean-architecture

flutter clean architect help for network and third sdk manager

I am planning to use clean architecture in Flutter to develop my upcoming projects. Currently, I’m using libraries such as flutter_bloc and get_it. The entire project is composed of core, features, and infrastructure.The problems I’ve encountered are as follows:

Requesting permissions while using Flutter Clean Architecture?

I need to request permissions for the camera and Bluetooth in one of my features, and I’m using the permission_handler package. I’m not sure if I should inject the permission_handler package inside the feature’s data layers by passing it as a local datasource, or if I should create a separate feature specifically for handling permissions with different usecases for the camera and Bluetooth ?

How to handle crashlytics with clean architecture flutter?

I want to report uncaught exceptions using Crashlytics. So, within the RepositoryImpl in the data layer, I can use a catch block to report the exceptions. However, I’m wondering whether Crashlytics should be added as a data source or if it should be a separate module, which would then be passed to RepositoryImpl, similar to how Reso Coder handles creating a seperate network directory for network info for internet connection checking ?

Working with stream-based functionality in flutter clean architecture?

I’m struggling to work with stream-based functionalities using clean architecture (Uncle bob / Reso coder), as clean architecture provides rules to work with. A normal flow with Future methods would be getting data from DataSource -> Repository -> UseCase -> Bloc/Cubit -> Screen. This works easily with Future methods and is easy to conceptualize within the framework of clean architecture. However, I’m not finding a proper way to work in the same manner with streams, from getting data to displaying it on the screen, without breaking the clean architecture rules and following the same structure as with Future methods.

Internet check stream in a Flutter app with clean architecture and Cubit?

I’ve set up my project with clean architecture and Cubits for state management. I have also set up a NetworkInfo class in the core/network folder, which has a future method to check internet connection. I’m using it in the RepositoryImpl class, and everything is working fine. However, I’m currently struggling to add an internet check stream to continuously check internet status. I’m not sure which layer I should add the code to or how to work with streams with Cubit without violating clean architecture principles and ensuring testability of the code?