Fat Shorthand Get link Facebook X Pinterest Email Other Apps December 05, 2023 /// Fat Arrow Notationvoid main() { print(add(10,50));}int add(var a, var b) => a + b;//Fat arrow notation is used only for single expression Get link Facebook X Pinterest Email Other Apps Comments
Second GET API Calling with Bloc simple Example in Flutter June 05, 2024 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 .... Read more
Exception_Dart October 30, 2023 import "dart:io" ; // void main() { // try { // checkage(10); // } catch(e) { // print(e); // } // } // void checkage(int age) { // if(age < 18) { // throw new FormatException("This is not Eligible"); // } // } //Example 1 // void main() { // int x = 12; // int y = 0; // int ans; // // try { // ans = x ~/ y; // } catch(e) { // print(e); // } // } //Example 2 // void main() { // var no1 = 10, no2 = 0, no3 = 0; // // no3 = no1 ~/ no2; //1st Method to indicate // no3 = (no1 / no2) as int; //2nd Method to indicate // print(no3); // } //Example 3 // void main() { // //Program 1: // // double no1 = 10; // // double no2 = 0; // // double no3 = 0; // // no3 = no1/no2; // // print(no3); //OUTPUT : Infinity // // // //Program 2 : // //Here below in this case program will stop // // int no4 = 10; // // int no5 = 0; // // int no6 = 0; // // no6 = no4 ~/ no5; // // print(no6); //OUTPUT : Unhandl... Read more
Pagination with Bloc Pattern in Flutter June 05, 2024 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... Read more
Comments
Post a Comment