title: In Dart, is it possible to pass an argument in a singleton?
body: <pre><code>class Peoples {
    late int id;
    late String name;
  
    static final Peoples _inst = Peoples._internal();
  
    Peoples._internal();
  
    factory Peoples() {
      return _inst;
    }
  }
  </code></pre>
  <p>I have this singleton class. Which ensures that, only one instance of a class is ever created. So, even if someone tries to instantiate it, they will use the same instance. And i can create and set values, like:</p>
  <pre><code>  Peoples ps1 = Peoples();
    Peoples ps2 = Peoples();
  
    ps1.id = 1;
    ps1.name = &quot;First&quot;;
  
    ps2.id = 2;
    ps2.name = &quot;Second&quot;;
  </code></pre>
  <p>Is it possible to instantiate and set values like:</p>
  <pre><code>  Peoples ps1 = Peoples(1, &quot;First&quot;);
    Peoples ps2 = Peoples(2, &quot;Second&quot;);
  </code></pre>
  <p>So, now both &quot;ps1&quot; and &quot;ps2&quot; will have (2, &quot;Second&quot;).</p>