-
Notifications
You must be signed in to change notification settings - Fork 570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Colors.black
as a primarySwatch causes an opaque error
#1650
Comments
Related to #1649 |
I'm curious why this code doesn't throw a type error during analysis. |
Type checking FTW. Now I'm thinking that the problem is with printing assertion failures:
This prints an error in the javascript console, but not the DartPad console. |
One of the areas of tech debt we really need to address is error reporting in general. If this can be bundled into some of the DartPad work we've already talked about in the next few months (by you or anyone else), it'd be worth the investment. |
Another case where this shows up: import 'package:flutter/material.dart';
void main() {
runApp(const ListViewApp());
}
class ListViewApp extends StatelessWidget {
static const itemCount = 10;
const ListViewApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(),
body: ListView.builder(
// itemCount: itemCount, // uncomment to fix!
itemBuilder: (context, idx) {
assert(idx < itemCount);
return ListTile(
title: Text('$idx'),
);
},
),
),
);
}
}
We should be displaying something more user-friendly instead of crashing. Running locally shows a red widget of death: but in DartPad we get a stack trace in the JavaScript console and
|
Tracking this issue here: #1966 |
Using
Colors.black
as a primarySwatch causes an opaque errorprimarySwatch
fromColors.blue
toColors.black
Here's the error in the javascript console:
The text was updated successfully, but these errors were encountered: