Posts

Showing posts from April, 2021
 DART MAP Map<String, int> phoneBook ={   'kyle': 98765698754,   'oper': 1234567998,   'asdf': 98754336779,  }; main(){   phoneBook['anshu'] = 1234567890;  // to add new key and value   print(phoneBook['kyle']); }
 DART ENUM used for making user defined datatypes e.g. enum Car {               suv,               hatchback,               coupe,               luxury }                    Now Car become a user datatypes and this contain these above names call    Car.suv  ,  Car.coupe  etc. In any func. we may write like        Car cartype    here cartype is variable under Car datatypes DART TERNARY OPERATOR Replacement for if else statement if( cond. ) {     .cond true then if runs................. } else {          cond. rong then else } TERNARY OPERATOR SYNTAX                                  ...
Refractor Same code of widget in different widget can be shorten by making new widget by refractor  example Container ( margin: EdgeInsets . all ( 15 ) , decoration: BoxDecoration ( color: Color ( 0xFF1d1f33 ) , borderRadius: BorderRadius . circular ( 12 ) , this above code is used multiple times in different widget so we use refractor then by refractor we can name new widget replacing this above code example   --    ReusableCard () , by Refracting, this code made by android studio A  Key  is an identifier for  Widget s,  Element s and  SemanticsNode s. class ReusableCard extends StatelessWidget { const ReusableCard({ Key key , }) : super (key: key) ; @override Widget build (BuildContext context) { return Container ( margin: EdgeInsets . all ( 15 ) , decoration: BoxDecoration ( color: Color ( 0xFF1d1f33 ) , borderRadius: BorderRadius . circular ( 12 ) , ) , ) ; } }
  ThemeData  class theme: ThemeData( primaryColor: Colors.blue, accentColor: Colors.green, textTheme: TextTheme(bodyText2: TextStyle(color: Colors.purple)), ), and many other properties in this. for whole app theme: ThemeData . dark ().copyWith( // c opywith for showing body text we primaryColor: Color ( 0xFF0a0d22 ) , can also take only themedata scaffoldBackgroundColor: Color ( 0xFF090c21 ) , ) , For particular icon floatingActionButton: Theme ( data: ThemeData ( accentColor: Colors. purple , ) , child: FloatingActionButton ( child: Icon (Icons. add ) , ) , ) ,
 Pillars of flutter ABSTRACTION ENCAPSULATION INGERITANCE POLYMORPHISM
Image
 Classes and Objects classes are blueprint . Name of Classes starts with capital letter.  classes have i)properties                         ii)Methods -  functions in Class Example Object of class classes and objects void main(){   Human jenny = Human(15);    // here we created jenny as object in class of Human   print(jenny.height);      jenny.talk('Why gods create this universe');   } class Human {   double height;   int age = 0;      Human(double startingHeight){     height = startingHeight;   }      void talk(String whatTosay){     // talk is method and call of method as shown above     print(whatTosay);   } } Inheritance we can create more classes based on another class or we simply say that this we can create class which has  inherited  property and method from oth...
Image
LIST IN DART  void main(){   List myList  = ['Vanya' , 'rogersville', 'Harshi' , 'zxcvbnm', 'qwertyio'];   print(myList[2]);   print(myList.indexOf('Harshi'));   myList.add('asdfghjkl');    // to add new value   myList.insert(2,'lkjhg');    // to add value at specific index   print(myList);   myList.  // various option are available , see when you write like this } do list ko banakar, we can compare like question and answer lists and match them Conditional statement import 'dart:math'; void main(){   loveCalculator(); } void loveCalculator(){   int loveScore = Random().nextInt(100) + 1 ;   print(loveScore);   if(loveScore > 80 && loveScore < 90){     print('True love');   }   if(loveScore > 90){     print('Pure Love');   }   else{     print('only attraction');   } } Conditional  'if statement'  ,  'if-else' , ' i...