The Dart Datetime class has several named constructors, but is DateTime.parse()not one of them. Instead, it DateTime.parse()is a static method that returns a DateTime. For me, this makes sense as a constructor (since you are generating a new DateTime object in a manner not too different from the constructor Datetime.utc()).
The theories that I came up with should reflect the fact that int.parseit is not a constructor or allows you to simplify the chain (you do not need to use a cascading operator with a static method). But perhaps there is another reason that I do not think about. Does anyone know why they did not make it a named constructor?
source
share