Breaking: DiagnosticsNode.toStringDeep added wrapWidth parameter
- Dominant language
- Dart
- Stars
- 179k
- Forks
- 31.1k
- PR merge metrics
- PR metrics pending
Description
PR https://github.com/flutter/flutter/pull/154752 adds a new parameter to the `toStringDeep` method in [3.27.0-0.0.pre](https://github.com/flutter/flutter/releases/tag/3.27.0-0.0.pre)
```diff
String toStringDeep({
String prefixLineOne = '',
String? prefixOtherLines,
DiagnosticLevel minLevel = DiagnosticLevel.debug,
+ int wrapWidth = 65,
}) {
```
This breakes existing Widgets that override `toStringDeep` like this in current state `Flutter 3.24.4`:
```dart
class BetterContainer extends Container {
@override
String toStringDeep({
String prefixLineOne = '',
String? prefixOtherLines,
DiagnosticLevel minLevel = DiagnosticLevel.debug,
}) {
return "Custom toStringDeep Representation";
}
}
```
```
'BetterContainer. toStringDeep' ('String Function({DiagnosticLevel minLevel, String prefixLineOne, String? prefixOtherLines})') isn't a valid override of 'DiagnosticableTree. toStringDeep' ('String Function({DiagnosticLevel minLevel, String prefixLineOne, String? prefixOtherLines, int wrapWidth})'). (Documentation)
The member being overridden (diagnostics.dart:366).
```
Open source packages affected by this change:
- https://github.com/ethanblake4/flutter_eval/blob/master/lib/src/widgets/text.dart#L83
- https://github.com/passsy/spot/blob/main/lib/src/spot/text/any_text.dart#L227
Unfortunately, I couldn't come up with any workaround that would allow supporting the new and old version at the same time.
Contributor guide
Assessment
This issue has not been assessed yet.