A minha tela está dando o seguinte erro "Launching lib\main.dart on sdk gphone x86 in debug mode... Running Gradle task 'assembleDebug'... lib/Difficulty.dart:10:5: Error: Type 'key' not found. key? key, ^^^ lib/Difficulty.dart:9:10: Error: The parameter 'dificultyLevel' can't have a value of 'null' because of its type 'int', but the implicit default value is 'null'. Try adding either an explicit non-'null' default value or the 'required' modifier. this.dificultyLevel, ^^^^^^^^^^^^^^ lib/Difficulty.dart:10:5: Error: 'key' isn't a type. key? key, ^^^ Target kernel_snapshot failed: Exception
FAILURE: Build failed with an exception.
Where: Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1201
What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.
Process 'command 'C:\src\flutter\bin\flutter.bat'' finished with non-zero exit value 1
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 18s Exception: Gradle task assembleDebug failed with exit code 1"
Segue código do difficulty.dart
import 'package:flutter/material.dart';
class Difficulty extends StatelessWidget {
final int dificultyLevel;
const Difficulty({
this.dificultyLevel,
key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Row(
children: [
Icon(
Icons.star,
size: 15,
color: (dificultyLevel >= 1) ? Colors.blue : Colors.blue[100],
),
Icon(
Icons.star,
size: 15,
color: (dificultyLevel >= 2) ? Colors.blue : Colors.blue[100],
),
Icon(
Icons.star,
size: 15,
color: (dificultyLevel >= 3) ? Colors.blue : Colors.blue[100],
),
Icon(
Icons.star,
size: 15,
color: (dificultyLevel >= 4) ? Colors.blue : Colors.blue[100],
),
Icon(
Icons.star,
size: 15,
color: (dificultyLevel >= 5) ? Colors.blue : Colors.blue[100],
),
],
);
}
}