Open
Description
There exists a case where the Duration
created from an int seconds
results in an unexpected value.
Steps to reproduce
- evaluate
Duration(seconds: 66666666666666660).inSeconds == 133584280340
This returns true
. I would expect it to return false
.
I see two options for how this could be resolved:
- The
.inSeconds
should return the value that was used during initialization. - Alternatively if the seconds value is not valid (too large)
Duration(seconds:)
should throw or returnnull
during initialization.
Infos about the environment:
- I ran from Android Studio on ARM Mac on an iOS Simulator
Tooling:
- Dart 3.7.2 (stable) (Tue Mar 11 04:27:50 2025 -0700) on "macos_arm64"
- on macos / Version 15.3.2 (Build 24D81)
- locale is en-DE