My picker:
return new NumberPickerDialog.decimal( minValue: 37, maxValue: 42, initialDoubleValue: 37.5, );
I did some debugging, looks like in _onDecimalNotification(Notification notification)
the decimalValueInTheMiddle
is too big (37 in my case). Upon closer looking I am actually confused what the purpose of that variable is.
The relevant problem happens towards the end:
double newValue = ((selectedIntValue + decimalPart).toDouble());
The decimal part in my case is 3.7 (gets formed from the 37 I mentioned above). If I understand that correctly, the decimal part should be between 0(inclusive) and 1(exclusive).
In my case the newValue becomes too big at some point which is why the number picker craps out with an assertion error from the constructor (min max selected check)
Exception:
I/flutter (12075): ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
I/flutter (12075): The following assertion was thrown building NumberPickerDialog(dirty, state:
I/flutter (12075): _NumberPickerDialogControllerState#2927b):
I/flutter (12075): 'package:numberpicker/numberpicker.dart': Failed assertion: line 58 pos 16: 'initialValue >=
I/flutter (12075): minValue && initialValue <= maxValue': is not true.
I/flutter (12075):
I/flutter (12075): Either the assertion indicates an error in the framework itself, or we should provide substantially
I/flutter (12075): more information in this error message to help you determine and fix the underlying cause.
I/flutter (12075): In either case, please report this assertion by filing a bug on GitHub:
I/flutter (12075): https://github.com/flutter/flutter/issues/new
I/flutter (12075):
I/flutter (12075): When the exception was thrown, this was the stack:
I/flutter (12075): #2 new NumberPicker.decimal (package:numberpicker/numberpicker.dart)
I/flutter (12075): #3 _NumberPickerDialogControllerState._buildNumberPicker (package:numberpicker/numberpicker.dart:396:18)
I/flutter (12075): #4 _NumberPickerDialogControllerState.build (package:numberpicker/numberpicker.dart:417:16)
I/flutter (12075): #5 StatefulElement.build (package:flutter/src/widgets/framework.dart:3730:27)
I/flutter (12075): #6 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:3642:15)
I/flutter (12075): #7 Element.rebuild (package:flutter/src/widgets/framework.dart:3495:5)
I/flutter (12075): #8 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2242:33)
I/flutter (12075): #9 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding&WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:626:20)
I/flutter (12075): #10 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding&PaintingBinding&RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:208:5)
I/flutter (12075): #11 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:990:15)
I/flutter (12075): #12 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:930:9)
I/flutter (12075): #13 _WidgetsFlutterBinding&BindingBase&GestureBinding&ServicesBinding&SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:842:5)
I/flutter (12075): #14 _invoke (dart:ui/hooks.dart:120:13)
I/flutter (12075): #15 _drawFrame (dart:ui/hooks.dart:109:3)
I/flutter (12075): (elided 2 frames from class _AssertionError)
I/flutter (12075): ════════════════════════════════════════════════════════════════════════════════════════════════════
bug