// Copyright 2015 The Chromium Authors. All rights reserved.// Use of this source code is governed by a BSD-style license that can be// found in the LICENSE file.import'dart:math';// This class represents a dot-separated version string. Used for comparing// versions.// Usage: assert(new Version('1.1.0') < new Version('1.2.1'));classVersion{Version(StringversionStr):_parts=versionStr.split('.').map((val)=>int.parse(val)).toList();List<int>_parts;booloperator<(Versionother)=>_compare(other)<0;booloperator==(dynamicother)=>otherisVersion&&_compare(other)==0;booloperator>(Versionother)=>_compare(other)>0;int_compare(Versionother){intlength=min(_parts.length,other._parts.length);for(inti=0;i<length;++i){if(_parts[i]<other._parts[i])return-1;if(_parts[i]>other._parts[i])return1;}return_parts.length-other._parts.length;// results in 1.0 < 1.0.0}intgethashCode=>_parts.fold(373,(acc,part)=>37*acc+part);}