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
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
Fibonacci Series Programme in Dart Flutter May 30, 2024 import 'dart:io' ; /// 1st Method for Fibonacci Series // void main() // { // print("Please Enter the no. of terms of Fibonacci sequence to print : "); // var terms = int.parse(stdin.readLineSync().toString()); // // var no1 = 0; // var no2 = 1; // // print(no1); // print(no2); // // for(int i = 3; i <= terms; i++) // { // int sum = no1 + no2; // print(sum); // no1 = no2; // no2 = sum; // } // } /// 2nd Method for Fibonacci Series void main () { print ( "Please Enter the no. of terms of Fibonacci sequence to print : " ) ; var terms = int. parse ( stdin.readLineSync () .toString () ) ; List < int > fiboSeq = [ 0 , 1 ] ; while ( fiboSeq. length < terms ) { int sum = fiboSeq [ fiboSeq. length - 1 ] + fiboSeq [ fiboSeq. length - 2 ] ; fiboSeq.add ( sum ) ; } print ( fiboSeq ) ; } Please Enter the no. of terms of Fibonacci sequence to print : 5 [0, 1, 1, 2, 3] Please Enter the no. of... Read more
Snackbar using GetX December 30, 2023 import "package:flutter/material.dart" ; import "package:get/get.dart" ; void main () { runApp( const MyApp ()) ; } class MyApp extends StatelessWidget { const MyApp({ super .key}) ; @override Widget build (BuildContext context) { return GetMaterialApp ( title: "Snack bar using Getx" , debugShowCheckedModeBanner: false, theme: ThemeData ( primarySwatch: Colors. grey , ) , home: const PracticeSnackbar () , ) ; } } class PracticeSnackbar extends StatelessWidget { const PracticeSnackbar({ super .key}) ; @override Widget build (BuildContext context) { return Scaffold ( appBar: AppBar ( title: const Text ( "Snackbar using GetX" ) , centerTitle: true, backgroundColor: Colors. grey , ) , body: Center ( child: Column ( mainAxisAlignment: MainAxisAlignment. center , crossAxisAlignment: CrossAxisAlignment. center , ... Read more
Comments
Post a Comment