https://dart.dev/language/constructors#factory-constructors

 

class Database {
  static final Database _instance = Database._internal();
  
  Database._internal() {
    print("Called Constructors");
  }
  
  factory Database.instance() => _instance;
  
  info() {
    print(_instance);
  }
}

void main() {
  Database d1 = Database.instance();
  d1.info();
  
  Database d2 = Database.instance();
  d2.info();
  
  Database d3 = Database.instance();
  d3.info();
}
Called Constructors
Instance of 'Database'
Instance of 'Database'
Instance of 'Database'