title: Flutter GetX Get.back() or navigator.pop() deletes controller from memory and can not recreate it
body: <p>I have two pages: <strong>HomePage</strong> and <strong>DetailsPage</strong> and associated <strong>GetxControllers</strong>.</p>
  <p><strong>HomePage</strong>:</p>
  <pre><code>class HomePage extends GetView&lt;HomeController&gt; {
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(title: Text('HomePage')),
        body: Container(
          child: Obx(
            () =&gt; ListView.builder(
              itemCount: controller.task.length,
              itemBuilder: (context, index) {
                return ListTile(
                  leading: Text('${index + 1}'),
                  title: Text(controller.task[index][&quot;name&quot;]),
                  onTap: () {
                    Get.to(
                      DetailsPage(),
                      arguments: controller.task[index][&quot;name&quot;],
                    );
                  },
                );
              },
            ),
          ),
        ),
      );
    }
  }
  </code></pre>
  <p><strong>HomeController</strong>:</p>
  <pre><code>class HomeController extends GetxController {
    final TaskRepository repository;
    HomeController({@required this.repository}) : assert(repository != null);
  
    final _task = [].obs;
    set task(value) =&gt; this._task.assignAll(value);
    get task =&gt; this._task;
  
    onInit() {
      super.onInit();
      getAllTask();
    }
  
    getAllTask() {
      repository.getAll().then((value) =&gt; task = value);
    }
  }
  </code></pre>
  <p>As you can see the <strong>HomeController</strong> depends on a <strong>TaskRepository</strong> which is a mock repo.</p>
  <p>And my <strong>DetailsPage</strong>:</p>
  <pre><code>class DetailsPage extends GetView&lt;DetailsController&gt; {
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        body: Column(
          children: [
            GestureDetector(
              onTap: () {
                Get.back();
              },
              child: Row(
                children: [
                  Icon(Icons.arrow_back),
                  Text('Go Back'),
                ],
              ),
            ),
            Expanded(
              child: Center(
                child: Obx(
                  () =&gt; Text(controller.taskDetail.value),
                ),
              ),
            ),
          ],
        ),
      );
    }
  }
  </code></pre>
  <p><strong>DetailsController</strong>:</p>
  <pre><code>class DetailsController extends GetxController {
    final taskDetail = ''.obs;
  
    @override
    void onInit() {
      super.onInit();
      taskDetail.value = Get.arguments;
    }
  }
  </code></pre>
  <p>I have created an <strong>AppDependencies</strong> class to initialize the dependencies (controllers, repositories, API clients, etc.):</p>
  <pre><code>class AppDependencies {
    static Future&lt;void&gt; init() async {
      Get.lazyPut(() =&gt; HomeController(repository: Get.find()));
      Get.lazyPut(() =&gt; DetailsController());
      Get.lazyPut(() =&gt; TaskRepository(apiClient: Get.find()));
      Get.lazyPut(() =&gt; TaskClient());
    }
  }
  </code></pre>
  <p>I am initializing all the dependencies by calling <code>AppDependencies.init()</code> on <code>main()</code>:</p>
  <pre><code>void main() async {
    await AppDependencies.init();
    runApp(MyApp());
  }
  
  class MyApp extends StatelessWidget {
    @override
    Widget build(BuildContext context) {
      return GetMaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: HomePage(),
      );
    }
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/HB52k.png" rel="noreferrer">HomePage</a></p>
  <p><a href="https://i.stack.imgur.com/QTrD4.png" rel="noreferrer">DetailsPage first time</a></p>
  <p><a href="https://i.stack.imgur.com/QTbbz.png" rel="noreferrer">Going back to HomePage and then Going again to DetailsPage</a></p>
  <p>As you can see on the third image, going back from <strong>DetailsPage</strong> to <strong>HomePage</strong> and going back to <strong>DetailsPage</strong> causes an exception saying:</p>
  <pre><code>&quot;DetailsController&quot; not found. You need to call &quot;Get.put(DetailsController())&quot; or &quot;Get.lazyPut(()=&gt;DetailsController())&quot;
  </code></pre>
  <p>But I already did that on <code>main()</code>. I also tried with <code>Get.put()</code> instead of <code>Get.lazyPut()</code> but I found that for <code>Get.put()</code> any dependencies of any other dependency must be registered before the dependent one. For example, HomeController depends on TaskRepository so TaskRepository must be before HomeController if using <code>Get.put()</code> like:</p>
  <pre><code>Get.put(TaskRepository());
  
  Get.put(HomeController());
  </code></pre>
  <p>And this is not what I want because I don't wanna track what comes before what manually.
  And I found that this causes if there's a back button (which almost every page has).</p>
  <p>What I am doing wrong here?</p>