Use super.key instead of manually passing the Key parameter to the parent class (#147621)

*Use `super.key` instead of manually passing the `Key` parameter using super(key: key) in the constructors.*

Since if you create a widget the new default will use `super.key` instead of `Key? key : super(key: key)` this small change is to maintain the consistency, it has no semantic change

also there are some other places that might need to be updated:

![image](https://github.com/flutter/flutter/assets/73608287/898f62f5-10f9-4d76-a46c-6def328177cb)

this file for example generate l10n project and it has all the dart code as String, it might have tests that validate the output somewhere that I might miss, also there are some other places like the `_Segment` class where it require `ValueKey` instead if `Key` so I didn't update them (even though it's possible)
This commit is contained in:
Ellet
2024-05-14 01:12:49 +03:00
committed by GitHub
parent 3391ddf55d
commit 876aa48ea5
8 changed files with 13 additions and 16 deletions

View File

@@ -74,9 +74,9 @@ class _ListViewExampleState extends State<ListViewExample> {
class KeepAliveItem extends StatefulWidget {
const KeepAliveItem({
required Key key,
required Key super.key,
required this.data,
}) : super(key: key);
});
final String data;