Closed as not planned
Closed as not planned
Description
What happened?
I expected DartPad to accept positional parameters being placed in any order with named parameters but this is not the case.
Steps to reproduce problem
The minimum case to reproduce the error is:
import 'package:flutter/material.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return const Text(key: Key('hello'), 'hello',);
}
}
The errors that DartPad returns is:
"Error compiling to JavaScript:
/tmp/dartpadUTEEFM/lib/main.dart:10:18: Error: Constant evaluation error:
return const Text(key: Key('hello'), 'hello');
^
/tmp/dartpadUTEEFM/lib/main.dart:10:28: Context: The variable '(unnamed)' is not a constant, only constant expressions are allowed.
return const Text(key: Key('hello'), 'hello');"
The error can be fixed by changing the line: return const Text(key: Key('hello'), 'hello',);
to return const Text('hello', key: Key('hello'),);
Metadata
Metadata
Assignees
Labels
No labels