I have these two ways to write a constructor. className()
and className._()
What is the difference between them and when should I use which?
class GlobalState{
final Map<dynamic,dynamic> _data=<dynamic,dynamic>{};
static GlobalState instance = new GlobalState._();
GlobalState._();
}
//In Main Class
GlobalState _store=GlobalState.instance;
and
class GlobalState{
final Map<dynamic,dynamic> _data=<dynamic,dynamic>{};
static GlobalState instance = new GlobalState();
}
//In Main Class
GlobalState _store=GlobalState();