Error:
The following RangeError was thrown building...
max must be in range 0 < max ≤ 2^32, was 0...
When the exception was thrown, this was the stack:
dart-sdk/lib/_internal/js_dev_runtime/private/ddcruntime/errors.dart 297:3 throw
dart-sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart 88:7 nextInt
packages/wave_blob/utils.dart 12:59 get randomNumber
packages/wave_blob/wave_drawable.dart 179:53 [_generateBlob]
packages/wave_blob/wave_drawable.dart 46:7 new
packages/wave_blob/wave_blob.dart 62:17 initState
packages/flutter/src/widgets/framework.dart 5611:55 [_firstBuild]
...
Hey, try it. Is working now.
class Utils {
static final v.Matrix4 _matrix = v.Matrix4.identity();
static final Random _random = Random();
static const double maxAmplitude = 8500;
static const double maxScale = 1.3;
// static int get randomNumber => _random.nextInt(1 << 32) - (1 << 31);
static int get randomNumber => _random.nextInt(1 << 31); // Changed here
....
class WaveDrawable{
...
void _generateBlob(List r, List a, int i) {
double angleDif = 360 / N 0.05;
double radDif = _maxRadius - _minRadius;
// r[i] = _minRadius + ((Utils.randomNumber % 100) / 100).abs() radDif;
// a[i] = 360 / N i + ((Utils.randomNumber % 100) / 100) angleDif;
// _speed[i] = (0.017 + 0.003 * ((Utils.randomNumber % 100).abs() / 100));
Error: The following RangeError was thrown building... max must be in range 0 < max ≤ 2^32, was 0... When the exception was thrown, this was the stack: dart-sdk/lib/_internal/js_dev_runtime/private/ddcruntime/errors.dart 297:3 throw dart-sdk/lib/_internal/js_dev_runtime/patch/math_patch.dart 88:7 nextInt packages/wave_blob/utils.dart 12:59 get randomNumber packages/wave_blob/wave_drawable.dart 179:53 [_generateBlob] packages/wave_blob/wave_drawable.dart 46:7 new packages/wave_blob/wave_blob.dart 62:17 initState packages/flutter/src/widgets/framework.dart 5611:55 [_firstBuild] ...
Hey, try it. Is working now.
class Utils { static final v.Matrix4 _matrix = v.Matrix4.identity(); static final Random _random = Random(); static const double maxAmplitude = 8500; static const double maxScale = 1.3;
// static int get randomNumber => _random.nextInt(1 << 32) - (1 << 31); static int get randomNumber => _random.nextInt(1 << 31); // Changed here
....
class WaveDrawable{ ...
void _generateBlob(List r, List a, int i) {
double angleDif = 360 / N 0.05;
double radDif = _maxRadius - _minRadius;
// r[i] = _minRadius + ((Utils.randomNumber % 100) / 100).abs() radDif;
// a[i] = 360 / N i + ((Utils.randomNumber % 100) / 100) angleDif;
// _speed[i] = (0.017 + 0.003 * ((Utils.randomNumber % 100).abs() / 100));
}
}