Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What does ._internal() mean in Singleton Pattern? #2

Closed
tagirahmad opened this issue Apr 3, 2021 · 2 comments
Closed

What does ._internal() mean in Singleton Pattern? #2

tagirahmad opened this issue Apr 3, 2021 · 2 comments

Comments

@tagirahmad
Copy link

Hello, please, explain, what does ._internal() mean in Singleton Pattern?

class Me {
  static final Me _singleton = new Me._internal();
  static final String _name = "Tyler";

  factory Me() {
    return _singleton;
  }

  static String get name => _name;
 
  @override
  String toString() => "Hello, my name is $name.";

  Me._internal();
}
Me._internal()
@Foriyo
Copy link

Foriyo commented May 2, 2021

Hii @tagirahmad _internal() is a named constructor. Just search about named constructors in dart you will get the answer.

@scottt2
Copy link
Owner

scottt2 commented May 2, 2021

@Foriyo Thanks for answering!

@tagirahmad Sorry I completely missed this notification. Please don't ever hesitate to ping my handle directly if you have any future questions.

@scottt2 scottt2 closed this as completed May 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants