-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
d: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.
Description
The following code leads to a surprise:
final Path path = Path()..lineTo(10, 0);
final PathMetrics metrics = path.computeMetrics();
final PathMetric metric = metrics.first;
print(metric.length); // 10.0
metrics.iterator.moveNext();
print(metric.length); // 0.0 !!This means things like metrics.toList() are very confusing. The length getter can probably be pretty easily fixed by making it less lazy (maybe force it to instantiate and store it on the Dart side at least when the iterator moves). The methods might be a bit more tricky - I think we'd need to expand out the full iteration on the C++ side and cache them for the lifetime of the object (if we should fix them at all).
At the very least, I think we should fix length (it's very confusing for a property to change like that) and document how the methods will work (if at all).
zbarryte-luminopia
Metadata
Metadata
Assignees
Labels
d: api docsIssues with https://api.flutter.dev/Issues with https://api.flutter.dev/engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.