- Notifications
You must be signed in to change notification settings - Fork1.7k
Description
whenever i delete a specific controller and get Back to a screen if the controller is null it initializes again but In my case a have a global Alerts screen which is accessed from multiple screens, from my Home screen when accessed i need to delete the HomeController it meets my specific needs but the Alerts is opened via a Custom Bottom Tab which makes the current controller causing a null check used on null value error to occur. This might not be a big issue but for new developers it does not point where this error is being generated please provide a proper a error or stackTrace if this occurs.
below is your Code in the the file get_state.dart
class GetBuilderState extends State<GetBuilder>
with GetStateUpdaterMixin {
T? controller;
bool? _isCreator = false;
VoidCallback? _remove;
Object? _filter;
@OverRide
void initState() {
// _GetBuilderState._currentState = this;
super.initState();
widget.initState?.call(this);
var isRegistered = GetInstance().isRegistered<T>(tag: widget.tag);if (widget.global) { if (isRegistered) { if (GetInstance().isPrepared<T>(tag: widget.tag)) { _isCreator = true; } else { _isCreator = false; } controller = GetInstance().find<T>(tag: widget.tag); } else { controller = widget.init; _isCreator = true; GetInstance().put<T>(controller!, tag: widget.tag); }
//// GetInstance().put(controller!, tag: widget.tag);///
This is whats causing the error please rethrow a proper error here