Repository: flutter
Issue: `Matrix4.translate()` with an `int` value crashes on mobile 
Labels: c: crash,framework,has reproducible steps,P2,found in release: 3.7,found in release: 3.10,team-framework,triaged-framework

### Is there an existing issue for this?

- [X] I have searched the [existing issues](https://github.com/flutter/flutter/issues)
- [X] I have read the [guide to filing a bug](https://flutter.dev/docs/resources/bug-reports)

### Steps to reproduce

To get the error :
1. Execute ````flutter run```` on the code sample on a Mobile device.

To see that the same code works fine : 

2. Execute ````flutter run```` on the code sample on a web browser.

Hi there, I know how to solve the following issue and I understand that we could pass a `double` value of `0.0` for the `x` param in the `Matrix4.identity()..translate` method, and that way the app wouldn't crash, but the question here is why does using a value of `0` work fine on web browsers but crashes on mobile? The code sample below runs without errors on a web browser but when tested on a mobile device, it throws an `[UnimplementedError]`. This can be confusing for new Flutter learners who had no issue getting their code to run successfully on a web browser but then encountered a sudden crash when testing on a mobile device. 

The error message doesn't provide clear instructions on how to fix the issue which can be simply avoided by stating something like: `Expected a value of type 'double', but got one of type 'int'`

I have noticed some users that have faced this exact same issue and were confused by the "sudden" crash even though they "didn't change anything in their code" That's why I am suggesting this change. It would help the users recognize what they did wrong faster.




### Expected results

 
 I have actually made a simple attempt to try and "solve this issue": simply adding a `Matrix4TypeError error` and calling it when the value of `x` is an `int` it would return this : 
 
 
```
 ═══════ Exception caught by widgets library ═══════════════════════════════════
The following message was thrown building OnTapTranslate(dirty, state: _OnTapTranslateState#a1a0d):
Expected a value of type 'double', but got one of type 'int'

The relevant error-causing widget was
OnTapTranslate
lib\main.dart:6
When the exception was thrown, this was the stack
#0      Matrix4.translate
package:vector_math/…/vector_math_64/matrix4.dart:682
#1      _OnTapTranslateState.build
package:hello_world/try_issues/gesture_matrix4.dart:13
#2      StatefulElement.build
package:flutter/…/widgets/framework.dart:5198
#3      ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:5086
#4      StatefulElement.performRebuild
package:flutter/…/widgets/framework.dart:5251
#5      Element.rebuild
package:flutter/…/widgets/framework.dart:4805
#6      ComponentElement._firstBuild
package:flutter/…/widgets/framework.dart:5068
#7      StatefulElement._firstBuild
package:flutter/…/widgets/framework.dart:5242
#8      ComponentElement.mount
package:flutter/…/widgets/framework.dart:5062`
```

### Actual results

<details><summary>Logs</summary>

```console
═══════ Exception caught by widgets library ═══════════════════════════════════
The following UnimplementedError was thrown building OnTapTranslate(dirty, state: _OnTapTranslateState#fe22e):
UnimplementedError

The relevant error-causing widget was
OnTapTranslate
lib\main.dart:6
When the exception was thrown, this was the stack
#0      Matrix4.translate
package:vector_math/…/vector_math_64/matrix4.dart:682
#1      _OnTapTranslateState.build
package:hello_world/try_issues/gesture_matrix4.dart:14
#2      StatefulElement.build
package:flutter/…/widgets/framework.dart:5198
#3      ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:5086
#4      StatefulElement.performRebuild
package:flutter/…/widgets/framework.dart:5251
#5      Element.rebuild
package:flutter/…/widgets/framework.dart:4805
#6      ComponentElement._firstBuild
package:flutter/…/widgets/framework.dart:5068
#7      StatefulElement._firstBuild
package:flutter/…/widgets/framework.dart:5242
#8      ComponentElement.mount
package:flutter/…/widgets/framework.dart:5062
...     Normal element mounting (27 frames)
#35     Element.inflateWidget
package:flutter/…/widgets/framework.dart:3971
#36     Element.updateChild
package:flutter/…/widgets/framework.dart:3708
#37     RenderObjectToWidgetElement._rebuild
package:flutter/…/widgets/binding.dart:1253
#38     RenderObjectToWidgetElement.mount
package:flutter/…/widgets/binding.dart:1222
#39     RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure>
package:flutter/…/widgets/binding.dart:1169
#40     BuildOwner.buildScope
package:flutter/…/widgets/framework.dart:2720
#41     RenderObjectToWidgetAdapter.attachToRenderTree
package:flutter/…/widgets/binding.dart:1168
#42     WidgetsBinding.attachRootWidget
package:flutter/…/widgets/binding.dart:1001
#43     WidgetsBinding.scheduleAttachRootWidget.<anonymous closure>
package:flutter/…/widgets/binding.dart:981
#47     _RawReceivePort._handleMessage (dart:isolate-patch/isolate_patch.dart:189:12)
(elided 3 frames from class _Timer and dart:async-patch)
════════════════════════════════════════════════════════════════════════════
```

</details>


### Code sample

<details><summary>Code sample</summary>

```Dart
import 'package:flutter/material.dart';
void main() => runApp(OnTapTranslate());

class OnTapTranslate extends StatefulWidget {
  @override
  _OnTapTranslateState createState() => _OnTapTranslateState();
}

class _OnTapTranslateState extends State<OnTapTranslate> {
  bool isTapped = false;

  @override
  Widget build(BuildContext context) {
    final Matrix4 tapped = Matrix4.identity()..translate(0, -10, 0);
    final Matrix4 transform = isTapped ? tapped : Matrix4.identity();

    return MaterialApp(
      home: Scaffold(
        body: Center(
          child: Transform(
            transform: transform,
            alignment: FractionalOffset.center,
            child: GestureDetector(
              onTap: () {
                setState(() {
                  isTapped = !isTapped;
                });
              },
              child: Container(
                color: Colors.blue,
                height: 100.0,
                width: 200.0,
              ),
            ),
          ),
        ),
      ),
    );
  }
}

```

</details>


### Screenshots or Video

<details>
<summary>video of the code working on a web browser</summary>

[translateOnWeb.webm](https://user-images.githubusercontent.com/82158584/234698491-3adfc99b-3335-4dba-b3fb-48e6ffadffc6.webm)


</details>
<details>
<summary>screenshot of the code crashing on a mobile device</summary>

![crash](https://user-images.githubusercontent.com/82158584/234698305-7c4f2dd6-9ebd-485c-8f19-8ad3b1a5c92f.jpg)


</details>


### Logs

_No response_

### Flutter Doctor output

<details><summary>Doctor output</summary>

```console
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel master, 3.9.0-17.0.pre.566, on Microsoft Windows [version 10.0.19045.2846], locale en-US)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0-rc2)
[√] Chrome - develop for the web
[X] Visual Studio - develop for Windows
    X Visual Studio not installed; this is necessary for Windows development.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2022.1)
[√] VS Code, 64-bit edition
[√] Connected device (3 available)
[√] Network resources

! Doctor found issues in 1 category.```

</details>