mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Extracts a TextRange class with a base and extent, and start(), end(), collapsed(), and length() getters. The possibility of reversed base and extent in selections and composing ranges makes reasoning about them complex and increases the chances of errors in the code. This change migrates most uses of base and extent in the text model to start()/end() or position(). The position() method is intended purely as an aid to readability to indicate that a collapsed selection is expected at the call site; it also enforces a debug-time assertion that this is the case.