@@ -19,11 +19,11 @@ void throwNumber() {
1919}
2020
2121void throwObject () {
22- throw new Object (); // LINT
22+ throw Object (); // LINT
2323}
2424
2525void throwError () {
26- throw new Error (); // OK
26+ throw Error (); // OK
2727}
2828
2929void throwDynamicPrebuiltError () {
@@ -32,17 +32,17 @@ void throwDynamicPrebuiltError() {
3232}
3333
3434void throwStaticPrebuiltError () {
35- Error error = new Error ();
35+ Error error = Error ();
3636 throw error; // OK
3737}
3838
3939void throwArgumentError () {
40- Error error = new ArgumentError ('oh!' );
40+ Error error = ArgumentError ('oh!' );
4141 throw error; // OK
4242}
4343
4444void throwException () {
45- Exception exception = new Exception ('oh!' );
45+ Exception exception = Exception ('oh!' );
4646 throw exception; // OK
4747}
4848
@@ -56,18 +56,17 @@ void throwExceptionFromFunction() {
5656 throw returnException ();
5757}
5858
59- Exception returnException () => new Exception ('oh!' );
59+ Exception returnException () => Exception ('oh!' );
6060
6161// TODO: Even though in the test this does not get linted, it does while
6262// analyzing the SDK code. Find out why.
6363dynamic noSuchMethod (Invocation invocation) {
64- throw new NoSuchMethodError (new Object (), invocation.memberName,
65- invocation.positionalArguments, invocation.namedArguments);
64+ throw NoSuchMethodError .withInvocation (Object (), invocation);
6665}
6766
6867class Err extends Object with Exception {
6968 static throws () {
70- throw new Err (); // OK
69+ throw Err (); // OK
7170 }
7271}
7372
0 commit comments