flutter / flutter/devtools

Document implications of tracking widget creation, and use of --no-track-widget-creation flag

Offen
#2,171 17 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
cost: high P3 screen: inspector
Vorherrschende Sprache
Dart
Sterne
1.7k
Forks
404
Ø Merge
6 T. 17 Std.
Gemergte PRs (30 T.)
18

Beschreibung

*@2ZeroSix commented on Apr 30, 2020, 7:51 PM UTC:*

using dart sdk shipped with flutter:

```
Flutter (Channel master, 1.18.0-9.0.pre.74, on Mac OS X 10.15.3 19D76,
locale en-RU)
• Flutter version 1.18.0-9.0.pre.74 at /Users/iam/development/flutter
• Framework revision 0d452b8305 (42 minutes ago), 2020-04-30 11:20:14 -0700
• Engine revision 2db3276573
• Dart version 2.9.0 (build 2.9.0-3.0.dev 726d3c7725)

```

this code works differently only in debug build

```dart
import 'package:flutter/widgets.dart';

void main() {
final generatedListOfConst = [
...{
const SizedBox(),
const SizedBox(),
},
];
print(generatedListOfConst);
}
```

expected (dev_compiler, aot, ...): `[SizedBox]`
actual (Dart VM): `[SizedBox, SizedBox]`

same result for any other Flutter widget in place of `SizedBox`, but for some reason it does work as expected for other objects

```dart
class EmptyWidget extends StatelessWidget {
const EmptyWidget({Key key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Container();
}
}

class Empty {
const Empty();
}

void main() {
final generatedListOfConstWidgets = [
...{
const EmptyWidget(),
const EmptyWidget(),
},
];
print(generatedListOfConstWidgets);

final generatedListOfConst = [
...{
const Empty(),
const Empty(),
},
];
print(generatedListOfConst);

final generatedListOfStr = [
...{
'a',
'a',
},
];
print(generatedListOfStr);
}
```

Dart VM output:

```
[EmptyWidget, EmptyWidget]
[Instance of 'Empty']
[a]

```

*This issue was moved by [keertip](https://github.com/keertip) from [dart-lang/sdk#41728](https://github.com/dart-lang/sdk/issues/41728).*

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start by reviewing the --no-track-widget-creation flag and the moved Dart SDK report in the issue body. The issue names no documentation file, test, or entry point; done means documenting the flag's implications and widget-creation tracking behavior in an agreed location.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
dart
Bereich
documentation
Issue-Typ
Dokumentation
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.