We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Dart code delta
diff --git a/lib/src/vector_math/matrix2.dart b/lib/src/vector_math/matrix2.dart index cd102bd..0ed5119 100644 --- a/lib/src/vector_math/matrix2.dart +++ b/lib/src/vector_math/matrix2.dart @@ -218,19 +218,12 @@ class Matrix2 { @pragma('wasm:prefer-inline') @pragma('vm:prefer-inline') @pragma('dart2js:prefer-inline') - dynamic operator *(dynamic arg) { - final Object result; - if (arg is double) { - result = scaled(arg); - } else if (arg is Vector2) { - result = transformed(arg); - } else if (arg is Matrix2) { - result = multiplied(arg); - } else { - throw ArgumentError(arg); - } - return result; - } + dynamic operator *(dynamic arg) => switch (arg) { + double() => scaled(arg), + Vector2() => transformed(arg), + Matrix2() => multiplied(arg), + _ => throw ArgumentError(arg) + };
TFA delta
The text was updated successfully, but these errors were encountered:
Nevermind
Sorry, something went wrong.
No branches or pull requests
Dart code delta
TFA delta
The text was updated successfully, but these errors were encountered: