getx icon indicating copy to clipboard operation
getx copied to clipboard

controller not found

Open zhanvyuan opened this issue 10 months ago • 1 comments

[GETX] CLOSE TO ROUTE /xxxViewController
[GETX] "xxxController" onDelete() called
[GETX] "xxxController" deleted from memory

════════ Exception caught by widgets library ═══════════════════════════════════
The following message was thrown building:
"xxxController" not found. You need to call "Get.put(xxxController())" or "Get.lazyPut(()=>xxxController())"
Flutter version 3.19.0-6.0.pre 
get: ^4.6.5

route

GetPage(
        name: xxxViewController.routerName,
        page: () => const xxxViewController(),
        binding: BindingsBuilder(
          () => Get.lazyPut(() => xxxController()),
        ),
      ),

navigateTo

Get.toNamed(xxxViewController.routerName)

controller

import 'package:flutter/material.dart';
import 'package:get/get.dart';

class LTKBaseViewController extends xxxxxViewController {
  static const String routerName = "/xxxViewController";

  const xxxViewController({super.key});

  @override
  xxxController get controller => GetInstance().find<xxxController>(tag: tag);
}

pop normally not have problem, only when open a dialog and then pop, this issue occur, even if the dialog cancel without any action

zhanvyuan avatar Jun 11 '25 11:06 zhanvyuan

set fenix true,like

Get.lazyPut(() => xxxController(), fenix: true)

aptentity avatar Sep 19 '25 03:09 aptentity