Search
 
SCRIPT & CODE EXAMPLE
 

DART

Cascade notation

void main() {
  Person()
    ..name = "John"
    ..age = 30
    ..sex = "Male"
    ..describeMyself();
}

class Person {
  String? name;
  int? age;
  String? sex;

  Person({this.name, this.age, this.sex});

  void describeMyself() {
    print('Hello my name is $name, I am $age years old');
  }
}
Comment

cascade notation

// Dart Cascade notation: myObject..someMethod()
querySelector('#confirm')
..text = 'Confirm'
..classes.add('important')
..onClick.listen((e) => window.alert('Confirmed!'));
// can replace (you don’t need the button variable):
var button = querySelector('#confirm');
button.text = 'Confirm';
button.classes.add('important');
button.onClick.listen((e) => window.alert('Confirmed!'));
Comment

PREVIOUS NEXT
Code Example
Dart :: dart length 
Dart :: dart remove the last letter in a string 
Dart :: flutter container rounded corners 
Swift :: string to capital letter dart 
Swift :: center text swiftui 
Swift :: Split a String into an array in Swift 
Swift :: double to string swift 
Swift :: play sound in swift 5 
Swift :: swift create label programmatically 
Swift :: swift open web page 
Swift :: add toggle without text swiftui 
Swift :: swift ui function with return value 
Swift :: how to select but not focus textfield swift 
Swift :: swift struct field default value 
Swift :: navigationController.pushViewController 
Swift :: swift how to sort array 
Swift :: swift clear user defaults 
Swift :: power number in swift13 
Swift :: how to change background color of ui button swift 
Swift :: uiimageview set image swift 
Swift :: manifest merger failed in android studio 
Swift :: how to set the center in view in swift 
Swift :: How to hide view in swiftui 
Swift :: change ui button swift 
Swift :: record permission swift 4 
Swift :: how to set return type swift 
Swift :: can you pass an enum as a parameter to a function swift 
Swift :: swift reduce function 
Swift :: how to add dragdown gesture recognizer on view 
Swift :: Swift Initializer 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =