position.dart 479 B

123456789101112131415161718192021222324252627
  1. import 'package:flutter/material.dart';
  2. import './path.dart';
  3. class Position {
  4. final Path path;
  5. final int offset;
  6. Position({
  7. required this.path,
  8. this.offset = 0,
  9. });
  10. @override
  11. bool operator ==(Object other) {
  12. if (other is! Position) {
  13. return false;
  14. }
  15. return pathEquals(path, other.path) && offset == other.offset;
  16. }
  17. @override
  18. int get hashCode {
  19. final pathHash = hashList(path);
  20. return Object.hash(pathHash, offset);
  21. }
  22. }