「Flutter/dart/singleton」の版間の差分
提供: 初心者エンジニアの簡易メモ
(ページの作成:「<pre> class SingletonHoge { SingletonHoge._privateConstructor(); static final SingletonHoge _instance = SingletonHoge._privateConstructor(); static SingletonHoge ge...」) |
|||
| 行8: | 行8: | ||
} | } | ||
</pre> | </pre> | ||
| + | |||
| + | https://stackoverflow.com/questions/12649573/how-do-you-build-a-singleton-in-dart | ||
2019年12月2日 (月) 21:24時点における版
class SingletonHoge {
SingletonHoge._privateConstructor();
static final SingletonHoge _instance = SingletonHoge._privateConstructor();
static SingletonHoge get instance {
return _instance;
}
}
https://stackoverflow.com/questions/12649573/how-do-you-build-a-singleton-in-dart
