<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vivek Sharma on Medium]]></title>
        <description><![CDATA[Stories by Vivek Sharma on Medium]]></description>
        <link>https://medium.com/@imviveksharma?source=rss-e372fa6faafc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*YP81ngzvM8xk_XGg4PaoIQ.jpeg</url>
            <title>Stories by Vivek Sharma on Medium</title>
            <link>https://medium.com/@imviveksharma?source=rss-e372fa6faafc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 03:40:38 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@imviveksharma/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Managing Large Features in Flutter with a Single-State BLoC Architecture]]></title>
            <link>https://medium.com/@imviveksharma/managing-large-features-in-flutter-with-a-single-state-bloc-architecture-72e747c24c18?source=rss-e372fa6faafc------2</link>
            <guid isPermaLink="false">https://medium.com/p/72e747c24c18</guid>
            <category><![CDATA[state-management]]></category>
            <category><![CDATA[flutter-bloc]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[bloc]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <dc:creator><![CDATA[Vivek Sharma]]></dc:creator>
            <pubDate>Sun, 13 Jul 2025 07:06:31 GMT</pubDate>
            <atom:updated>2025-07-13T07:06:31.916Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9uZOpkdo1wVeBcgLAjyOwg.png" /><figcaption>flutter bloc with single state</figcaption></figure><p>Flutter’s BLoC (Business Logic Component) pattern is a powerful tool for managing state in scalable apps. However, many developers use multiple states for different UI needs — which often leads to boilerplate and unnecessary increases the complexity of code.</p><p>In this article, I’ll show you a <strong>production-ready approach using a single state model</strong> with Cubit and <strong>BlocSelector</strong> to selectively listen for state changes. This results in clean, efficient, and maintainable code.</p><p>💡 Why Use a Single State Object?</p><p>Managing all your Cubit’s data in one immutable state object makes your app:</p><ul><li>Easier to debug</li><li>Easier to extend</li><li>More performant when paired with BlocSelector</li></ul><p>🧱 Project Structure</p><p>We’ll focus on three core files:</p><ul><li>auth_state.dart – The single state model</li><li>auth_cubit.dart – The business logic</li><li>main.dart – UI using BlocSelector for optimized rebuilds</li></ul><p>📄 1. <strong>auth_state.dart</strong> – The State Class</p><pre>part of &#39;auth_cubit.dart&#39;;<br><br>enum LoginState { loading, error, loggedIn, none }<br><br>enum LogoutState { loading, error, loggedOut, none }<br><br>class AuthState extends Equatable {<br>  final LoginState loginState;<br>  final LogoutState logOutState;<br>  const AuthState({required this.loginState, required this.logOutState});<br>  <br>  factory AuthState.initial() {<br>    return const AuthState(<br>      loginState: LoginState.none,<br>      logOutState: LogoutState.none,<br>    );<br>  }<br>  AuthState copyWith({LoginState? loginState, LogoutState? logOutState}) {<br>    return AuthState(<br>      loginState: loginState ?? this.loginState,<br>      logOutState: logOutState ?? this.logOutState,<br>    );<br>  }<br><br>  @override<br>  List&lt;Object&gt; get props =&gt; [loginState, logOutState];<br>}</pre><p>🔹 copyWith() allows us to update only the required fields.</p><p>🚀 2. <strong>auth_cubit.dart</strong> – The Cubit Logic</p><pre>import &#39;package:equatable/equatable.dart&#39;;<br>import &#39;package:flutter_bloc/flutter_bloc.dart&#39;;<br><br>part &#39;auth_state.dart&#39;;<br><br>class AuthCubit extends Cubit&lt;AuthState&gt; {<br>  AuthCubit() : super(AuthState.initial());<br><br>  void login() async {<br>    emit(state.copyWith(loginState: LoginState.loading));<br>    await Future.delayed(Duration(seconds: 2));<br>    emit(state.copyWith(loginState: LoginState.loggedIn));<br>  }<br><br>  void logout() async {<br>    emit(state.copyWith(logOutState: LogoutState.loading));<br>    await Future.delayed(Duration(seconds: 2));<br>    emit(state.copyWith(logOutState: LogoutState.loggedOut));<br>  }<br>}</pre><p>✅ Clear separation of logic<br>✅ Only emits state when there’s a meaningful change</p><p>🎯 3. <strong>main.dart</strong> – Smart UI with BlocSelector</p><pre>import &#39;package:bloc_single_state/app_button.dart&#39;;<br>import &#39;package:bloc_single_state/cubit/auth_cubit.dart&#39;;<br>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter_bloc/flutter_bloc.dart&#39;;<br><br>void main() {<br>  runApp(<br>    BlocProvider(create: (context) =&gt; AuthCubit(), child: const MainApp()),<br>  );<br>}<br><br>class MainApp extends StatelessWidget {<br>  const MainApp({super.key});<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return MaterialApp(<br>      home: Scaffold(<br>        backgroundColor: Colors.white,<br>        body: Center(<br>          child: Column(<br>            mainAxisAlignment: MainAxisAlignment.center,<br>            children: [<br>              BlocSelector&lt;AuthCubit, AuthState, LoginState&gt;(<br>                selector: (state) {<br>                  return state.loginState;<br>                },<br>                builder: (context, state) {<br>                  return AppButton(<br>                    onTap: () {<br>                      context.read&lt;AuthCubit&gt;().login();<br>                    },<br>                    isLoading: state == LoginState.loading,<br>                    text: state == LoginState.loggedIn ? &#39;Logged In&#39; : &#39;Log In&#39;,<br>                  );<br>                },<br>              ),<br>              SizedBox(height: 20),<br>              BlocSelector&lt;AuthCubit, AuthState, LogoutState&gt;(<br>                selector: (state) {<br>                  return state.logOutState;<br>                },<br>                builder: (context, state) {<br>                  return AppButton(<br>                    onTap: () {<br>                      context.read&lt;AuthCubit&gt;().logout();<br>                    },<br>                    isLoading: state == LogoutState.loading,<br>                    text: state == LogoutState.loggedOut<br>                        ? &#39;Logged Out&#39;<br>                        : &#39;Log Out&#39;,<br>                  );<br>                },<br>              ),<br>            ],<br>          ),<br>        ),<br>      ),<br>    );<br>  }<br>}</pre><p>✨ Why <strong>BlocSelector</strong>?</p><p>Instead of rebuilding the entire widget tree on every state change, we rebuild only parts of the UI that care about a specific slice of state.</p><p>You can create multiple selectors like this:</p><pre>BlocSelector&lt;AuthCubit, AuthState, String?&gt;(<br>  selector: (state) =&gt; state.error,<br>  builder: (context, error) {<br>    return error != null ? Text(error) : SizedBox.shrink();<br>  },<br>);</pre><p>Use <strong>BlocSelector</strong> when you&#39;re optimizing performance in complex UIs.</p><p><strong>app_button.dart</strong></p><pre>import &#39;package:flutter/material.dart&#39;;<br><br>typedef OnTap = void Function();<br><br>class AppButton extends StatelessWidget {<br>  final String text;<br>  final OnTap onTap;<br>  final bool isLoading;<br>  const AppButton({<br>    super.key,<br>    required this.text,<br>    required this.onTap,<br>    this.isLoading = false,<br>  });<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return TextButton(<br>      onPressed: () {<br>        onTap();<br>      },<br>      style: ButtonStyle(<br>        backgroundColor: WidgetStateProperty.all(Colors.blueAccent),<br>        fixedSize: WidgetStateProperty.all(Size(180, 50)),<br>      ),<br>      child: isLoading<br>          ? CircularProgressIndicator(<br>              valueColor: AlwaysStoppedAnimation(Colors.white),<br>            )<br>          : Text(text, style: TextStyle(color: Colors.white, fontSize: 20)),<br>    );<br>  }<br>}</pre><p>🧪 Real-World Use Case</p><p>In apps where multiple widgets depend on different parts of the state, combining <strong>single state + BlocSelector</strong> can prevent unexpected rebuilds and simplify testing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1omXPFle7ywz_XbXuizCkA.png" /><figcaption>flutter bloc single state</figcaption></figure><p>🧠 Final Thoughts</p><p>This pattern is especially useful when:</p><ul><li>Your state is not too large but shared across multiple widgets.</li><li>You need to reduce UI rebuilds.</li><li>You’re building production-ready, scalable apps.</li></ul><p>✅ Complete code on Github repo:</p><p><a href="https://github.com/follow2vivek/bloc_single_state">GitHub - follow2vivek/bloc_single_state</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72e747c24c18" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Clean Architecture with BLoC | Dio | GetIt]]></title>
            <link>https://medium.com/@imviveksharma/flutter-clean-architecture-with-bloc-dio-getit-10ac4e7d624b?source=rss-e372fa6faafc------2</link>
            <guid isPermaLink="false">https://medium.com/p/10ac4e7d624b</guid>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[flutter-bloc]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[bloc]]></category>
            <dc:creator><![CDATA[Vivek Sharma]]></dc:creator>
            <pubDate>Thu, 21 Mar 2024 16:57:23 GMT</pubDate>
            <atom:updated>2024-03-21T17:09:18.473Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CC5GWvMiI5ynWfIL" /><figcaption>Photo by <a href="https://unsplash.com/@roketpik?utm_source=medium&amp;utm_medium=referral">Artur Shamsutdinov</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In Clean Architecture, the software system is typically divided into distinct layers, each with its specific responsibilities and concerns. These layers include the data layer, domain layer, and presentation layer:</p><ol><li><strong>Data Layer:</strong></li></ol><ul><li><strong>Responsibility:</strong> The data layer is responsible for handling data access and persistence. It encapsulates interactions with databases, file systems, external services, or any other means of storing and retrieving data.</li><li><strong>Components:</strong> In the data layer, you’ll typically find repositories or data access objects (DAOs) that abstract the details of data storage and retrieval. These components provide interfaces for the domain layer to interact with the underlying data without exposing implementation details.</li><li><strong>Dependency Direction:</strong> Dependencies in the data layer typically point inward toward the domain layer. This means that the domain layer defines interfaces or contracts for data access, and the data layer implements these interfaces.</li></ul><p>2. <strong>Domain Layer:</strong></p><ul><li><strong>Responsibility:</strong> The domain layer contains the core business logic and rules of the application. It represents the heart of the software system, where the domain-specific concepts and behaviors are implemented.</li><li><strong>Components:</strong> In the domain layer, you’ll find entities, value objects, and use cases. Entities represent the main business objects, value objects encapsulate small pieces of immutable data, and use cases represent the application’s business logic.</li><li><strong>Dependency Direction:</strong> The domain layer is at the center of the architecture and should not have direct dependencies on external frameworks or technologies. Dependencies should point outward toward the interfaces defined in the data layer for data access and toward the presentation layer for user input/output.</li></ul><p>3. <strong>Presentation Layer:</strong></p><ul><li><strong>Responsibility:</strong> The presentation layer is responsible for presenting information to users and capturing user input. It encompasses user interfaces, such as graphical user interfaces (GUIs), command-line interfaces (CLIs), or APIs.</li><li><strong>Components:</strong> Components in the presentation layer include controllers, presenters, views, or API endpoints. These components handle user input, format data for display, and communicate user actions back to the domain layer.</li><li><strong>Dependency Direction:</strong> Dependencies in the presentation layer typically point inward toward the domain layer for accessing business logic and outward toward external libraries or frameworks for handling user interface concerns.</li></ul><p>In summary, Clean Architecture separates concerns into distinct layers, with the data layer handling data access and persistence, the domain layer containing the core business logic, and the presentation layer dealing with user interfaces and interactions. This separation promotes modularity, testability, and flexibility in software development.</p><p><strong>Implementation —</strong></p><p>Create new Flutter project and add following dependencies in pubspec.yaml.</p><pre>name: clean<br>description: A new Flutter project.<br>publish_to: &#39;none&#39; <br><br>version: 1.0.0+1<br><br>environment:<br>  sdk: &#39;&gt;=2.19.6 &lt;3.0.0&#39;<br><br>dependencies:<br>  flutter:<br>    sdk: flutter<br><br>  cupertino_icons: ^1.0.2<br>  retrofit: ^4.1.0<br>  dio: ^5.4.1<br>  http:<br>  get_it:<br>  flutter_bloc:<br><br>dev_dependencies:<br>  flutter_test:<br>    sdk: flutter<br><br>  flutter_lints: ^2.0.0<br>  retrofit_generator: ^8.1.0<br>  build_runner:<br><br>flutter:<br>  uses-material-design: true</pre><p>Let’s follow the directory structure for clean architecture.</p><p><strong>Domain Layer:</strong></p><ol><li>Entity — The entity class is same as model/pojo class. This entity will interact with UI. This will supply the data from data layer.</li><li>Repository — We will have 2 repository folder one inside data layer and one inside domain layer. This repository class will act as a bridge between domain and data layer. This class will be an abstract class and implementation will be written in data layer.</li><li>Usecases — Presentation layer will utilize the use-case classes to trigger the action from UI such as call the api, load data from local storage etc…</li></ol><p><strong>Data Layer:</strong></p><ol><li>Remote/Data Source — This will fetch the data either through API call or local database.</li><li>Model — This model class will be exact copy of entity class. Model classes of data layer will interact with remote/data source. This class can contain fromJson, toJson, or copyWith methods.</li><li>Repository — This repository class will contain the implementation of domain layer abstract class methods.</li></ol><p><strong>Presentation Layer:</strong></p><ol><li>Bloc/Provider — This will update the UI and this class will interact with use-case classes present in domain layer. All the UI inputs will be handled by use-case class.</li><li>Page — Write all the UI stuff here.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/334/1*mYz1g58zFozRAzv9msoJ7Q.png" /><figcaption>Folder structure of clean architecture</figcaption></figure><p>Now let’s look at the code.</p><p><strong>Domain Layer:</strong></p><p>domain -&gt; entities -&gt; user_entities.dart</p><pre>class UserEntity {<br>  Data? data;<br>  Support? support;<br><br>  UserEntity({this.data, this.support});<br>  <br>}<br><br>class Data {<br>  int? id;<br>  String? email;<br>  String? firstName;<br>  String? lastName;<br>  String? avatar;<br><br>  Data({this.id, this.email, this.firstName, this.lastName, this.avatar});<br>  <br>}<br><br>class Support {<br>  String? url;<br>  String? text;<br><br>  Support({this.url, this.text});<br>  <br>}</pre><p>domain -&gt; repository -&gt; user_repository.dart</p><pre>import &#39;../entities/user_entity.dart&#39;;<br><br>abstract class UserRepository{<br>  Future&lt;UserEntity&gt; getUserData();<br>}</pre><p>domain -&gt; usecases -&gt; user_usecase.dart</p><pre>import &#39;package:clean/domain/repository/user_repository.dart&#39;;<br><br>import &#39;../entities/user_entity.dart&#39;;<br><br>class UserUseCase {<br>  final UserRepository _repository;<br><br>  UserUseCase(this._repository);<br><br>  Future&lt;UserEntity&gt; execute() async=&gt; await _repository.getUserData();<br>}</pre><p><strong>Data Layer:</strong></p><p>data -&gt; repository -&gt; user_repository_impl.dart</p><pre>import &#39;package:clean/domain/entities/user_entity.dart&#39;;<br>import &#39;package:clean/domain/repository/user_repository.dart&#39;;<br><br>import &#39;../remote/user_remote.dart&#39;;<br><br>class UserRepositoryImpl implements UserRepository {<br>  UserRemote userRemote;<br><br>  UserRepositoryImpl(this.userRemote);<br><br>  @override<br>  Future&lt;UserEntity&gt; getUserData() async{<br>   final user = await userRemote.getUser();<br>   return UserEntity(<br>     data: Data(<br>       id: user.data?.id ?? 0,<br>       avatar: user.data!.avatar!,<br>       email: user.data!.email!,<br>       firstName: user.data!.firstName!,<br>       lastName: user.data!.lastName!,<br>     )<br>   );<br>  }<br>}</pre><p>data -&gt; model -&gt; user_model.dart</p><pre>import &#39;package:clean/domain/entities/user_entity.dart&#39;;<br><br>class UserModel {<br>  Data? data;<br>  Support? support;<br><br>  UserModel({this.data, this.support});<br><br>  UserModel.fromJson(Map&lt;String, dynamic&gt; json) {<br>    data = json[&#39;data&#39;] != null ? new Data.fromJson(json[&#39;data&#39;]) : null;<br>    support =<br>    json[&#39;support&#39;] != null ? new Support.fromJson(json[&#39;support&#39;]) : null;<br>  }<br><br>  Map&lt;String, dynamic&gt; toJson() {<br>    final Map&lt;String, dynamic&gt; data = new Map&lt;String, dynamic&gt;();<br>    if (this.data != null) {<br>      data[&#39;data&#39;] = this.data!.toJson();<br>    }<br>    if (this.support != null) {<br>      data[&#39;support&#39;] = this.support!.toJson();<br>    }<br>    return data;<br>  }<br><br>}<br><br>class Data {<br>  int? id;<br>  String? email;<br>  String? firstName;<br>  String? lastName;<br>  String? avatar;<br><br>  Data({this.id, this.email, this.firstName, this.lastName, this.avatar});<br><br>  Data.fromJson(Map&lt;String, dynamic&gt; json) {<br>    id = json[&#39;id&#39;];<br>    email = json[&#39;email&#39;];<br>    firstName = json[&#39;first_name&#39;];<br>    lastName = json[&#39;last_name&#39;];<br>    avatar = json[&#39;avatar&#39;];<br>  }<br><br>  Map&lt;String, dynamic&gt; toJson() {<br>    final Map&lt;String, dynamic&gt; data = new Map&lt;String, dynamic&gt;();<br>    data[&#39;id&#39;] = this.id;<br>    data[&#39;email&#39;] = this.email;<br>    data[&#39;first_name&#39;] = this.firstName;<br>    data[&#39;last_name&#39;] = this.lastName;<br>    data[&#39;avatar&#39;] = this.avatar;<br>    return data;<br>  }<br>}<br><br>class Support {<br>  String? url;<br>  String? text;<br><br>  Support({this.url, this.text});<br><br>  Support.fromJson(Map&lt;String, dynamic&gt; json) {<br>    url = json[&#39;url&#39;];<br>    text = json[&#39;text&#39;];<br>  }<br><br>  Map&lt;String, dynamic&gt; toJson() {<br>    final Map&lt;String, dynamic&gt; data = new Map&lt;String, dynamic&gt;();<br>    data[&#39;url&#39;] = this.url;<br>    data[&#39;text&#39;] = this.text;<br>    return data;<br>  }<br>}</pre><p>data -&gt; remote -&gt; user_remote.dart</p><pre><br>import &#39;package:dio/dio.dart&#39;;<br>import &#39;package:retrofit/http.dart&#39;;<br>import &#39;../model/user_model.dart&#39;;<br>part &#39;user_remote.g.dart&#39;;<br><br>@RestApi(baseUrl: &#39;https://reqres.in/&#39;)<br>abstract class UserRemote{<br>  factory UserRemote(Dio dio, {String baseUrl}) = _UserRemote;<br><br>  @GET(&#39;api/users/2&#39;)<br>  Future&lt;UserModel&gt; getUser();<br>}</pre><p><strong>Presentation Layer:</strong></p><p>presentation -&gt; bloc -&gt; user_cubit.dart</p><pre>import &#39;package:bloc/bloc.dart&#39;;<br>import &#39;package:clean/domain/entities/user_entity.dart&#39;;<br>import &#39;package:meta/meta.dart&#39;;<br><br>import &#39;../../domain/usecases/user_usecase.dart&#39;;<br><br>part &#39;user_state.dart&#39;;<br><br>class UserCubit extends Cubit&lt;UserState&gt; {<br>  final UserUseCase userUsecase;<br><br>  UserCubit(this.userUsecase) : super(UserInitial());<br><br>  void getUser() async {<br>    emit(UserLoading());<br>    final user = await userUsecase.execute();<br>    emit(UserSuccess(user));<br>  }<br>}</pre><p>presentation -&gt; bloc -&gt; user_state.dart</p><pre>part of &#39;user_cubit.dart&#39;;<br><br>@immutable<br>class UserState {}<br><br> class UserInitial extends UserState {}<br> class UserLoading extends UserState {}<br> class UserSuccess extends UserState {<br> UserEntity user;<br> UserSuccess(this.user);<br>}<br> class UserError extends UserState {}</pre><p>presentation -&gt; page -&gt; home_page.dart</p><pre>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter_bloc/flutter_bloc.dart&#39;;<br><br>import &#39;../bloc/user_cubit.dart&#39;;<br><br>class MyHomePage extends StatefulWidget {<br>  const MyHomePage({super.key, required this.title});<br><br>  final String title;<br><br>  @override<br>  State&lt;MyHomePage&gt; createState() =&gt; _MyHomePageState();<br>}<br><br>class _MyHomePageState extends State&lt;MyHomePage&gt; {<br><br>  @override<br>  void initState() {<br>    context.read&lt;UserCubit&gt;().getUser();<br>    super.initState();<br>  }<br><br>  @override<br>  Widget build(BuildContext context) {<br>    return Scaffold(<br>      appBar: AppBar(<br>        title: Text(widget.title),<br>      ),<br>      body: BlocBuilder&lt;UserCubit, UserState&gt;(<br>        builder: (context, state) {<br>          if(state is UserLoading){<br>            return Center(child: CircularProgressIndicator(),);<br>          }else if(state is UserSuccess){<br>            return Text(state.user.data?.firstName ?? &#39;no name&#39;);<br>          }<br>          return Text(&quot;Error&quot;);<br>        },<br>      ), // This trailing comma makes auto-formatting nicer for build methods.<br>    );<br>  }<br>}</pre><p>lib -&gt; main.dart</p><pre>import &#39;package:clean/di.dart&#39;;<br>import &#39;package:clean/presentation/bloc/user_cubit.dart&#39;;<br>import &#39;package:flutter/material.dart&#39;;<br>import &#39;package:flutter_bloc/flutter_bloc.dart&#39;;<br><br>import &#39;presentation/page/home_page.dart&#39;;<br><br>void main() {<br>  WidgetsFlutterBinding.ensureInitialized();<br>  setup();<br><br>  runApp(const MyApp());<br>}<br><br>class MyApp extends StatelessWidget {<br>  const MyApp({super.key});<br><br>  // This widget is the root of your application.<br>  @override<br>  Widget build(BuildContext context) {<br>    return BlocProvider(<br>      create: (context) =&gt;<br>          UserCubit(getIt()),<br>      child: MaterialApp(<br>        title: &#39;Flutter Clean Architecture&#39;,<br>        theme: ThemeData(<br>          primarySwatch: Colors.blue,<br>        ),<br>        home: const MyHomePage(title: &#39;Clean Architecture&#39;),<br>      ),<br>    );<br>  }<br>}</pre><p>lib -&gt; di.dart</p><pre><br>import &#39;package:clean/data/remote/user_remote.dart&#39;;<br>import &#39;package:clean/data/repository/user_repository_impl.dart&#39;;<br>import &#39;package:clean/domain/repository/user_repository.dart&#39;;<br>import &#39;package:clean/domain/usecases/user_usecase.dart&#39;;<br>import &#39;package:clean/presentation/bloc/user_cubit.dart&#39;;<br>import &#39;package:dio/dio.dart&#39;;<br>import &#39;package:get_it/get_it.dart&#39;;<br><br>final getIt = GetIt.instance;<br><br>void setup(){<br>  getIt.registerSingleton&lt;Dio&gt;(Dio());<br>  getIt.registerFactory(() =&gt; UserRemote(getIt()));<br>  getIt.registerFactory&lt;UserRepository&gt;(() =&gt; UserRepositoryImpl(getIt()));<br><br>  getIt.registerFactory(() =&gt; UserUseCase(getIt()));<br>  getIt.registerFactory(() =&gt; UserCubit(getIt()));<br>}</pre><p>Dio and other dependencies have been resolved through <a href="https://pub.dev/packages/get_it">get_it</a> dependency package.</p><p>Don’t forget to star the repository -&gt; <a href="https://github.com/follow2vivek/flutter-clean-architecture-with-bloc">https://github.com/follow2vivek/flutter-clean-architecture-with-bloc</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=10ac4e7d624b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Develop your next Android & iOS app in Flutter.]]></title>
            <link>https://medium.com/@imviveksharma/develop-your-next-android-ios-app-in-flutter-75fe30185bb4?source=rss-e372fa6faafc------2</link>
            <guid isPermaLink="false">https://medium.com/p/75fe30185bb4</guid>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[flutter-ui]]></category>
            <dc:creator><![CDATA[Vivek Sharma]]></dc:creator>
            <pubDate>Thu, 13 Jun 2019 05:21:26 GMT</pubDate>
            <atom:updated>2022-08-15T18:07:22.296Z</atom:updated>
            <content:encoded><![CDATA[<p>Let discuss, why we should develop Android &amp; iOS apps in Flutter and what is the benefit of Flutter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*jmUtlxeEbR3MMNVZfUee8w.png" /><figcaption>Flutter create app faster</figcaption></figure><p>Flutter is a cross-platform mobile application development SDK developed by Google, to reduce the development effort.</p><p>Why use Flutter:-</p><ol><li>Free and open source.</li><li>Faster app development.</li><li>Supports Android &amp; iOS.</li><li>Library and package development ease.</li><li>It has its own widgets.</li><li>Support for Mobile, Desktop, Web &amp; Embedded.</li><li>It is Native.</li><li>Single code &amp; low-cost project</li></ol><p>Let’s discuss the above point to understand Flutter in a better way.</p><ol><li><strong>Free and open source:-</strong> Flutter is a free and open source project initiated by Google to develop a cross-platform application. Flutter supports Android &amp; iOS but in the future, it will support <a href="https://en.wikipedia.org/wiki/Google_Fuchsia"><strong>Google Fuchsia OS</strong></a><strong>.</strong></li><li><strong>Faster app development:-</strong> It has a beautiful feature like hot reload &amp; hot restart which increases the app development x2. It uses a dart programming language that is similar to JAVA and easy to learn. Flutter run with 60 fps which makes the application animation much smoother.</li><li><strong>Support Android &amp; iOS:-</strong> Write a single code and run on the Android &amp; iOS platform with minimal effort.</li><li><strong>Library and package development ease:-</strong> Dart eases the package and library development as it supports both the platform and provides a method channel to port iOS and Android functionality to Flutter easily.</li><li><strong>It has its own widgets:-</strong> Flutter has its own widget for Android and iOS which is get rendered by <strong>Skia Graphic Engine</strong>, because of this engine apps take the same look and feel in both platforms. It has Material and Cupertino widgets to support Android &amp; iOS respectively to adopt the native look.</li><li><strong>Support for Mobile, Desktop, Web &amp; Embedded:-</strong> Now Flutter support to other environments also like Web, Desktop and Embedded device, if you want to have the same feel across the system.</li><li><strong>It is Native:-</strong> Flutter uses native code to run the application which means it will not feel like hybrid and it gives a native performance, like other platforms it doesn’t use the webview or javascript bridge to communicate with native platforms.</li><li><strong>Single code &amp; low-cost project:-</strong> Write a single code to run on the Android and iOS platform and it decreases the project development cost, time and resources.</li></ol><p>Try Flutter to create your next app.</p><p>Thank you for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=75fe30185bb4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>