Get lazyPut 与 put 的区别

279 阅读1分钟
    Get.lazyPut(()=>HomeController());
    Get.put(HomeController());

通过 lazyPut 设置的 HomeController 需要通过 Get.find() 才会真正的初始化。并且会给调用的页面绑定。当页面关闭的时候也会移除。

通过直接put实例方式添加,就相当于设置了一个单例。通过Get.find()获取,并且不会随着页面关闭移除。