Variables and Data Type

  • Steps

    1. variable

    
                      var name = 'Dart';
                      print(name);
    
                      name="Manoj";
                      

    2. Constant & final

    
                      final a = 12;
                      const pi = 3.14;
                      print(a);
                      print(pi);
    
                      // doesn't work!
                      a = 20;
                      pi=3;
    
                    

    3. List

    
    
                    var list = [1,2,3,4,5];
                    print(list);
                  

    4. Maps

    
                  var mapping = {'id': 1,'name':'Dart'};
                  print(mapping);
                

    5. dynamic

    
                dynamic name = "Dart";
                print(name);
              
    
              final Map<String, dynamic> requestBody = {
                "firstName": _firstNameTEController.text.trim(),
                "lastName": _lastNameTEController.text.trim(),
                "mobile": _mobileTEController.text.trim(),
                "photo": "",
              };
    
              if (_passwordTEController.text.isNotEmpty) {
                requestBody['password'] = _passwordTEController.text;
              }