Search
 
SCRIPT & CODE EXAMPLE
 

DART

dart create singleton with parameters

class Peoples {
  int id;
  String name;

  static final Peoples _inst = Peoples._internal();

  Peoples._internal();


  factory Peoples(int id, String name) {
    _inst.id = id;
    _inst.name = name;
    return _inst;
  }
}

void main() {
  print("Instance of = " + Peoples(0, "Dylan").name);
  print("Instance of = " + Peoples(1, "Joe").name);
  print("Instance of = " + Peoples(2, "Maria").name);
}
Comment

PREVIOUS NEXT
Code Example
Dart :: dart convert iterable to list 
Dart :: enum flutter 
Dart :: git revert to specific commit id and push 
Dart :: flutter table row height 
Dart :: flutter remove appbar leading padding 
Dart :: flutter only portrait 
Dart :: dart inline if else 
Dart :: flutter call phone number 
Dart :: flutter list distinct 
Dart :: convert string date to datetime and format 
Dart :: initialroute flutter 
Dart :: for in dart 
Dart :: Flutter bottom navigation bar change page programmatically 
Dart :: leading in flutter(drawer) 
Dart :: flutter inheritance 
Dart :: Flutter list of strings to one String 
Dart :: dart list equality 
Dart :: flutter get global context 
Dart :: OneSignalXCFramework (< 4.0, = 3.8.1, = 3.4.3) 
Dart :: concatenate in flutter 
Dart :: strapi starters 
Dart :: anonymous function in dart 
Dart :: use a class variable in other class in flutter 
Dart :: restrick platform orientation flutter 
Dart :: flutter sembast delete a single record 
Dart :: flutter gesturedetector space also clickable 
Dart :: * In pubspec.yaml the flutter.plugin.{androidPackage,iosPrefix,pluginClass} keys are deprecated. Instead use the flutter.plugin.platforms key introduced in Flutter 1.10.0 
Dart :: inkwell not splashing in stack 
Swift :: swift self.present full screen 
Swift :: xcode get info from text field 
ADD CONTENT
Topic
Content
Source link
Name
1+6 =