Maaz Zindani

Loading the index…

↑↓ move↵ openesc close4791 pages
Flutter and app store releases

Get.find cannot locate a GetX controller

Your error

"HomeController" not found. You need to call "Get.put(HomeController())" or "Get.lazyPut(()=>HomeController())"

Fix it fast

Most common cause, 1 of 3

The screen opened without the Binding that registers its controller

Write a Binding for the screen and attach it where the route is declared or pushed, under GetMaterialApp.

Fix
class HomeBinding extends Bindings {
  @override
  void dependencies() {
    Get.lazyPut<HomeController>(() => HomeController());
  }
}

GetMaterialApp(
  getPages: [
    GetPage(name: '/home', page: () => const HomeView(), binding: HomeBinding()),
  ],
);

// or when pushing directly:
Get.to(() => const HomeView(), binding: HomeBinding());
Did this fix it?
Full steps for this cause: check, fix, verify

Short answer

"HomeController" not found. You need to call "Get.put(HomeController())" means Get.find, often called by GetView, looked up a type and tag nothing had registered at that moment: the route's Binding never ran, SmartManagement deleted the controller with its route, or the tag or type differs. Register it in a Binding or keep it with permanent: true. Applies to get 4.7.3.

  • Applies to get 4.7.3 (latest stable, Dart 2.15+ and Flutter 3.13+), Flutter 3.38 to 3.50.x
  • Updated
  • By Maaz Zindani, Senior Software Engineer

Which cause do you have?

List every place that registers or looks up a controller. Compare where the failing type is put with where it is found: no registration on that route points to the first cause, a registration on an earlier route to the second, and a tag or different type to the third.

Run this first
grep -rnE "Get\.(put|lazyPut|putAsync|create|find)|GetView<|binding:|initialBinding" lib/

Then find the line you see in this list and open its fix:

  1. 1The screen opened without the Binding that registers its controllerNo Get.put or Get.lazyPut for the type runs before the screen builds, or the screen is opened with Navigator.push or a MaterialApp route instead of a GetPage or Get.to with a binding
  2. 2SmartManagement deleted the controller when the route that created it closedThe first screen works, and the error shows up on a later screen, or after Get.off or a back press, for a controller registered by an earlier route
  3. 3The instance was registered with a tag, or under another type, than the lookup usesGet.put uses tag: or registers a subclass or interface, while Get.find or GetView asks without that tag or for a different type

What does the error look like?

  • "HomeController" not found. You need to call "Get.put(HomeController())" or "Get.lazyPut(()=>HomeController())"

Cause 1 of 3

The screen opened without the Binding that registers its controller

You seeNo Get.put or Get.lazyPut for the type runs before the screen builds, or the screen is opened with Navigator.push or a MaterialApp route instead of a GetPage or Get.to with a binding

Check

GetView gives a view its controller by calling Get.find for you, so the controller must already be registered when the view builds. GetX registers route dependencies through Bindings: GetPage and navigation methods such as Get.to take a binding whose dependencies() runs Get.put or Get.lazyPut for that route. A route opened through plain Flutter navigation never runs that Binding, and the lookup fails.

Check
// does the route that shows HomeView carry a binding?
grep -rn "HomeView" lib/

Fix

Write a Binding for the screen and attach it where the route is declared or pushed, under GetMaterialApp.

Fix
class HomeBinding extends Bindings {
  @override
  void dependencies() {
    Get.lazyPut<HomeController>(() => HomeController());
  }
}

GetMaterialApp(
  getPages: [
    GetPage(name: '/home', page: () => const HomeView(), binding: HomeBinding()),
  ],
);

// or when pushing directly:
Get.to(() => const HomeView(), binding: HomeBinding());

Verify

The screen opens without the exception, and Get.isRegistered reports the controller while it is on screen.

Verify
debugPrint('${Get.isRegistered<HomeController>()}'); // true

Confirmed by pub.dev

Did this fix it?

Cause 2 of 3

SmartManagement deleted the controller when the route that created it closed

You seeThe first screen works, and the error shows up on a later screen, or after Get.off or a back press, for a controller registered by an earlier route

Check

With the default SmartManagement.full, GetX disposes classes that are no longer in use and were not set to be permanent; when a route leaves the stack, the controllers tied to it are removed from memory. A second screen that calls Get.find for a controller owned by a closed route therefore gets the not found error.

Check
// after leaving the first route:
debugPrint('${Get.isRegistered<CartController>()}'); // false

Fix

Register controllers that many screens share once, in an initialBinding, and mark them permanent. For one that may be dropped and rebuilt later, use lazyPut with fenix: true so GetX keeps the factory and recreates it on the next find.

Fix
class AppBinding extends Bindings {
  @override
  void dependencies() {
    Get.put<AuthController>(AuthController(), permanent: true);
    Get.lazyPut<CartController>(() => CartController(), fenix: true);
  }
}

GetMaterialApp(initialBinding: AppBinding(), getPages: appPages);

Verify

Leaving the first screen and opening the second no longer throws, and Get.find returns a controller each time.

Verify
debugPrint('${Get.find<CartController>()}');

Confirmed by pub.dev

Did this fix it?

Cause 3 of 3

The instance was registered with a tag, or under another type, than the lookup uses

You seeGet.put uses tag: or registers a subclass or interface, while Get.find or GetView asks without that tag or for a different type

Check

Get.find builds its lookup key from the type and the optional tag, so Get.put(ItemController(), tag: id) is invisible to Get.find<ItemController>() with no tag. Type works the same way: Get.put(FirebaseAuthService()) registers the concrete class, and Get.find<AuthService>() for its interface finds nothing. GetView has a tag property for exactly this case.

Check
grep -rn "tag:" lib/

Fix

Pass the same tag on both sides (in a GetView, override tag), and give Get.put the type you will look up.

Fix
Get.put(ItemController(), tag: item.id);
final c = Get.find<ItemController>(tag: item.id);

class ItemView extends GetView<ItemController> {
  const ItemView({super.key, required this.id});
  final String id;

  @override
  String? get tag => id;

  @override
  Widget build(BuildContext context) => Text(controller.title);
}

Get.put<AuthService>(FirebaseAuthService());

Verify

Each tagged view shows its own controller's data, and Get.find<AuthService>() returns the registered service.

Verify
debugPrint('${Get.isRegistered<ItemController>(tag: item.id)}'); // true

Confirmed by pub.dev

Did this fix it?

How do I stop it coming back?

  • Give every GetX screen a Binding attached to its GetPage, and navigate with Get.toNamed or Get.to so the Binding always runs.
  • Register app-wide services once in initialBinding with permanent: true rather than inside the first screen that happens to need them.
  • Build tags in one helper function used by both put and find, so a typo cannot split one controller into two keys.
  • Pin get to 4.7.3 in pubspec.yaml so a future major release cannot change these registration APIs under the app.

Sources

How was this page made?

I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.

Which stack is behind this page?

Projects of mine on the same stack: TaxiDex, Qist Bazaar, SessionBird.

Next step

Want this handled for good?

I look after servers, apps and releases end to end. Tell me what keeps breaking.