Singleton pattern using Google Flutter Dart language

 Author: Shengtao Zhou       Created: 9/24/2020 3:55:49 AM       Modified: 9/24/2020 3:55:49 AM   More...
Singleton pattern is the design pattern to return only 1 instance of a class. 
class Store {
  static final Store _singleton = Store._internal();
  List<Order> list = new List<Order>();

  factory Store() {
    return _singleton;
  }

  Store._internal();

  addOrder(Order order){
    list.Add(order);
  }
}
To make a call to a function inside the singleton class:
Store().addOrder(order);

More...          Back to List          

(Please enter you comments between 100 to 2000 characters. Thanks for your contribution.) 

         Created:       Modified: 

Editing a comment

       (Please enter you comments between 100 to 2000 characters. Please login before edit comment.) 

div class="col-md-2">