Search
 
SCRIPT & CODE EXAMPLE
 

DART

generic class in dart

class Stack<T> {
  List<T> _stack = [];

  void push(T item) => _stack.add(item);
  T pop() => _stack.removeLast();
}

// Example
final stack = Stack<String>();
stack.push("A string.");  
Comment

generic class in dart

class Person {
	String name;
    int age;
    List<String> likes = ["Coding", "Dart", "Comp Sci"];
    String _password = "Password123"; // This is a private variable, using an '_' at the start of a variable name makes it private.
    
    Person(String name, int age, List<String> likes) { // Constructor
    	this.name = name;
        this.age = age;
        this.likes = likes;
    }
    
    void SetPassword(String password) { // Setter
    	this._password = password;
    }
    
    String GetPassword() { // Getter
    	return _password;
	}
}
Comment

PREVIOUS NEXT
Code Example
Dart :: Flutter Rendering Widgets Using JSON Data 
Dart :: Flutter: How to point to localhost:8000 with the Dart http package in Flutter? 
Dart :: flutter sliver app bar remove top padding 
Dart :: how to stop listening to location change listener on dispose in flutter 
Dart :: dart int to str 
Dart :: dart list of lists 
Dart :: search in array dart 
Dart :: how to group data by date in a listview in flutter 
Dart :: flutter download file 
Dart :: flutter when to use methods 
Swift :: settimeout in swift 
Swift :: swift notifications mac 
Swift :: swift uitableview cell spacing 
Swift :: convert string to int swift 
Swift :: swift open settings page 
Swift :: xcode perform action when return key pressed text field 
Swift :: core data fetch request 
Swift :: round down swift 
Swift :: get index filter swift 
Swift :: hide status bar in tableview cell in swift 
Swift :: get keyboard height swift 
Swift :: how to loop swift 
Swift :: swift print 
Swift :: view controller modal fullscreen programmatically swift 5 
Swift :: swift uitextfield placeholder color 
Swift :: swiftui change form section color 
Swift :: convert image to base64 swift Ui 
Swift :: setting a local notification at specific time every day swift 
Swift :: Swift Loop Over Array 
Swift :: swift extension 
ADD CONTENT
Topic
Content
Source link
Name
4+5 =