SemanticsData constructor Null safety

  1. {required int flags,
  2. required int actions,
  3. required AttributedString attributedLabel,
  4. required AttributedString attributedValue,
  5. required AttributedString attributedIncreasedValue,
  6. required AttributedString attributedDecreasedValue,
  7. required AttributedString attributedHint,
  8. required String tooltip,
  9. required TextDirection? textDirection,
  10. required Rect rect,
  11. required double elevation,
  12. required double thickness,
  13. required TextSelection? textSelection,
  14. required int? scrollIndex,
  15. required int? scrollChildCount,
  16. required double? scrollPosition,
  17. required double? scrollExtentMax,
  18. required double? scrollExtentMin,
  19. required int? platformViewId,
  20. required int? maxValueLength,
  21. required int? currentValueLength,
  22. Set<SemanticsTag>? tags,
  23. Matrix4? transform,
  24. List<int>? customSemanticsActionIds}

Creates a semantics data object.

The flags, actions, label, and Rect arguments must not be null.

If label is not empty, then textDirection must also not be null.


  required this.flags,
  required this.actions,
  required this.attributedLabel,
  required this.attributedValue,
  required this.attributedIncreasedValue,
  required this.attributedDecreasedValue,
  required this.attributedHint,
  required this.tooltip,
  required this.textDirection,
  required this.rect,
  required this.elevation,
  required this.thickness,
  required this.textSelection,
  required this.scrollIndex,
  required this.scrollChildCount,
  required this.scrollPosition,
  required this.scrollExtentMax,
  required this.scrollExtentMin,
  required this.platformViewId,
  required this.maxValueLength,
  required this.currentValueLength,
}) : assert(flags != null),
     assert(actions != null),
     assert(attributedLabel != null),
     assert(attributedValue != null),
     assert(attributedDecreasedValue != null),
     assert(attributedIncreasedValue != null),
     assert(attributedHint != null),
     assert(tooltip == '' || textDirection != null, 'A SemanticsData object with tooltip "$tooltip" had a null textDirection.'),
     assert(attributedLabel.string == '' || textDirection != null, 'A SemanticsData object with label "${attributedLabel.string}" had a null textDirection.'),
     assert(attributedValue.string == '' || textDirection != null, 'A SemanticsData object with value "${attributedValue.string}" had a null textDirection.'),
     assert(attributedDecreasedValue.string == '' || textDirection != null, 'A SemanticsData object with decreasedValue "${attributedDecreasedValue.string}" had a null textDirection.'),
     assert(attributedIncreasedValue.string == '' || textDirection != null, 'A SemanticsData object with increasedValue "${attributedIncreasedValue.string}" had a null textDirection.'),
     assert(attributedHint.string == '' || textDirection != null, 'A SemanticsData object with hint "${attributedHint.string}" had a null textDirection.'),
     assert(rect != null);