blob: 033210b8c5aef920c885d5c6fb62bb2f79b96e8d [file] [log] [blame]
// Copyright 2013 The Flutter 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 'package:flutter/foundation.dart' show immutable;
/// Item used in the stroke pattern for a Polyline.
@immutable
class PatternItem {
const PatternItem._(this._json);
/// A dot used in the stroke pattern for a [Polyline].
static const PatternItem dot = PatternItem._(<Object>['dot']);
/// A dash used in the stroke pattern for a [Polyline].
///
/// [length] has to be non-negative.
static PatternItem dash(double length) {
assert(length >= 0.0);
return PatternItem._(<Object>['dash', length]);
}
/// A gap used in the stroke pattern for a [Polyline].
///
/// [length] has to be non-negative.
static PatternItem gap(double length) {
assert(length >= 0.0);
return PatternItem._(<Object>['gap', length]);
}
final Object _json;
/// Converts this object to something serializable in JSON.
Object toJson() => _json;
}