canonicalizedVersion property

String canonicalizedVersion

Get a canonicalized string representation of this Version.

Unlike Version.toString() this always returns a canonical string representation of this Version.

Example

final v = Version.parse('01.02.03-01.dev+pre.02');

assert(v.toString() == '01.02.03-01.dev+pre.02');
assert(v.canonicalizedVersion == '1.2.3-1.dev+pre.2');
assert(Version.parse(v.canonicalizedVersion) == v);

Implementation

String get canonicalizedVersion => Version(
      major,
      minor,
      patch,
      pre: preRelease.isNotEmpty ? preRelease.join('.') : null,
      build: build.isNotEmpty ? build.join('.') : null,
    ).toString();