Posts

Showing posts from June, 2024

Second GET API Calling with Bloc simple Example in Flutter

Image
  import "package:api_with_bloc/Fourth_Get_API_call_using_Bloc/bloc/users_bloc.dart" ; import "package:api_with_bloc/Fourth_Get_API_call_using_Bloc/bloc/users_bloc_states.dart" ; import "package:flutter/material.dart" ; import "package:flutter_bloc/flutter_bloc.dart" ; void main () { runApp ( const MyApp () ) ; } class MyApp extends StatelessWidget { const MyApp ( { super .key } ) ; @override Widget build ( BuildContext context ) { return BlocProvider < UsersBloc >( create: ( context ) => UsersBloc () , child: MaterialApp ( title: "HomePage" , debugShowCheckedModeBanner: false, theme: ThemeData ( appBarTheme: const AppBarTheme ( backgroundColor: Colors. grey , centerTitle: true, ) , ) , home: const HomePageFourth () , ) , ) ; } } class HomePageFourth extends StatelessWidget { const HomePageFourth ( { super ....

Third GET API Calling with Cubit in Flutter

Image
  import "package:api_with_cubit/4rth_Get_API_call_using_Cubit/cubit/cubit_users_state.dart" ; import "package:api_with_cubit/4rth_Get_API_call_using_Cubit/cubit/users_cubit.dart" ; import "package:flutter/material.dart" ; import "package:flutter_bloc/flutter_bloc.dart" ; void main () { runApp ( const MyApp () ) ; } class MyApp extends StatelessWidget { const MyApp ( { super .key } ) ; @override Widget build ( BuildContext context ) { return BlocProvider < UsersCubit >( create: ( context ) => UsersCubit () , child: MaterialApp ( title: "HomePage" , debugShowCheckedModeBanner: false, theme: ThemeData ( appBarTheme: const AppBarTheme ( backgroundColor: Colors. grey , centerTitle: true, ) , ) , home: const FourthHomePage () , ) , ) ; } } class FourthHomePage extends StatelessWidget { const FourthHomePage ( { su...

Pagination with Bloc Pattern in Flutter

Image
  import "package:flutter/material.dart" ; import "package:flutter_bloc/flutter_bloc.dart" ; import "package:pagination_practice/Pagination_with_Bloc/Bloc/bloc.dart" ; import "package:pagination_practice/Pagination_with_Bloc/Bloc/event.dart" ; import "package:pagination_practice/Pagination_with_Bloc/Bloc/state.dart" ; import "package:pagination_practice/Pagination_with_Bloc/post_repo.dart" ; void main () { runApp ( const MyApp () ) ; } class MyApp extends StatelessWidget { const MyApp ( { super .key } ) ; @override Widget build ( BuildContext context ) { return RepositoryProvider < PostRepo >( create: ( context ) => PostRepo () , child: BlocProvider < PostBloc > ( create: ( context ) => PostBloc ( context.read < PostRepo > () ) ..add ( FetchPostsEvent () ) , child: MaterialApp ( title: "Pagination" , debugShowCheckedModeBa...