Posts

Showing posts with the label Dart
DART   MIXINS Mixins are a way of reusing a class’s code in multiple class hierarchies.  
  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) ; } }
 DART   ASYNC AWAIT FUTURE
 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                                  ...
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...