alignment static method
Decodes an AlignmentDirectional or Alignment object out of the specified map.
If the map has start
and y
keys, then it is interpreted as an
AlignmentDirectional with those values. Otherwise if it has x
and y
it's an Alignment with those values. Otherwise it returns null.
Implementation
static AlignmentGeometry? alignment(DataSource source, List<Object> key) {
if (!source.isMap(key)) {
return null;
}
final double? x = source.v<double>([...key, 'x']);
final double? start = source.v<double>([...key, 'start']);
final double? y = source.v<double>([...key, 'y']);
if (x == null && start == null) {
return null;
}
if (y == null) {
return null;
}
if (start != null) {
return AlignmentDirectional(start, y);
}
x!;
return Alignment(x, y);
}