Carousel Builder from Future Builder and Firebase Flutter You can edit other like slide padding and others as per design var _dataLength = 1 ; var _index ; var slides ; @ override void initState () { getSliderImageFirebase (); super . initState (); } Future getSliderImageFromDB () async { var _fireStore = FirebaseFirestore . instance ; QuerySnapshot snapshot = await _fireStore . collection ( 'slider' ). get (); if ( mounted ) { setState (() { _dataLength = snapshot . docs . length ; }); } ...
Posts
- Get link
- X
- Other Apps
Carousel Building from Stream builder and Firebase Flutter @ override void initState () { _queryDb (); super . initState (); } Future _queryDb () { slides = FirebaseFirestore . instance . collection ( 'slider' ) . snapshots () . map (( list ) => list . docs . map (( doc ) => doc . data ())); return slides ; } @ override Widget build ( BuildContext context ) { return Column ( children : [ ...
- Get link
- X
- Other Apps
DART Static // to make any variable universal for all object belongs to that class // static is also applied to method of class // static work without any constructor int main(){ // Square myShape = Square(); not need constructor static int side = Square. noOfSide ; print(side) ; // Circle().getOurCircumference(radius: 20); // without static Circle. getOurCircumference (radius: 20 ) ; // with static, call by this // static work without any constructor as we seen above } class Square{ static int noOfSide = 4 ; } class Circle{ static const double pi = 3.1415926 ; static void getOurCircumference ({double radius}){ double circumference = 2 * pi * radius ; print(circumference) ; } }
- Get link
- X
- Other Apps
[ Dart ] Loops Type-1 void main () { buyMilk( 7 ) ; } void buyMilk (int days) { for (int i = 1 ; i <= days ; i++) { print( 'Buying milk on day $i ' ) ; } } Type-2 Example List<String> fruits = [ 'Apple' , 'Mango' , 'Banana' , 'Strawberry' , 'Grapes' ] ; void main(){ pieMaker() ; } void pieMaker (){ for (String fruit in fruits){ print(fruit + ' Pie' ) ; } } Example List<int> winningNumbers = [ 12 , 6 , 34 , 22 , 41 , 9 ] ; void main(){ List<int> ticket1 = [ 45 , 2 , 9 , 18 , 12 , 33 ] ; List<int> ticket2 = [ 41 , 17 , 26 , 7 , 35 , 32 ] ; checkNumber(ticket1) ; } void checkNumber (List<int> myNumber){ int match = 0 ; for (int myNum in myNumber){ for (int winNum in winningNumbers){ if (myNum == winNum){ match++ ; } } } print( 'Got a $match matches' ) ; }