factoryコンストラクタ(というかfactoryパターン)のメリットがよくわからないが、一つメリットと言えるのは
http://tomochikahara.com/blog/2013/08/08/factory-constructors-in-dart
3. 具象クラスの隠蔽
Factoryコンストラクタで返す値は、Factoryコンストラクタが定義されているクラスのインスタンスである必要はなく、その型に代入可能であるインスタンスであればよいので、実際に返すインスタンスのクラスを動的に変えることができます。
上記ページのサンプル。
bool isCountry(String name){ if(name=='nagoya'){ return false; }else{ return true; } } class Location { final String name; Location._internal(this.name); factory Location(String name) => isCountry(name) ? new Country(name) : new City(name); } class Country extends Location…