Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Controller Null Issue #3325

Open
Open
Assignees
jonataslaw
@sinanGsr

Description

@sinanGsr

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp