Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating to 3.4.3 results in NoSuchMethodError: The getter 'isInit' was called on null #457

Closed
oliverbytes opened this issue Aug 9, 2020 · 7 comments
Assignees

Comments

@oliverbytes
Copy link

Describe the bug
After updating to version 3.4.3 I get this error when running my app. No code changes were made and reverting back to 3.4.2 there's no error.

I/flutter ( 2754): NoSuchMethodError: The getter 'isInit' was called on null.
I/flutter ( 2754): Receiver: null
I/flutter ( 2754): Tried calling: isInit
I/flutter ( 2754):
I/flutter ( 2754): #0      Object.noSuchMethod  (dart:core-patch/object_patch.dart:51:5)
I/flutter ( 2754): #1      GetInstance.initDependencies 
package:get/…/instance/get_instance.dart:102
I/flutter ( 2754): #2      GetInstance.find 
package:get/…/instance/get_instance.dart:167
I/flutter ( 2754): #3      GetInstance.put 
package:get/…/instance/get_instance.dart:51
I/flutter ( 2754): #4      Inst.put 
package:get/…/instance/extension_instance.dart:23
I/flutter ( 2754): #5      new PostScreenController 
package:app/…/post/screen.controller.dart:22
I/flutter ( 2754): #6      AppController._initControllers 
package:app/…/app/app.controller.dart:119
I/flutter ( 2754): #7      AppController.onInit 
package:app/…/app/app.controller.dart:89
I/flutter ( 2754): #8      DisposableInterface.onStart 
package:get/…/rx/rx_interface.dart:30
I/flutter ( 2754): #9      GetInstance.startController 
package:get/…/instance/get_instance.dart:128
I/flutter ( 2754): #10     GetInstance.initDependencies 
package:get/…/instance/get_instance.dart:104
I/flutter ( 2754): #11     GetInstance.find 
package:get/…/instance/get_instance.dart:167
I/flutter ( 2754): #12     GetInstance.put (packa

Flutter Version:
Channel beta, 1.20.0

Get Version:
3.4.3

Describe on which device you found the bug:
OnePlus 8 - Real device

Minimal reproduce code
Basically, I have an AppController which is the very parent controller and overrides the onInit and initializes PostScreenController using Get.put

@Nipodemos
Copy link
Collaborator

Hello!
Please, it is better if you provide a minimal reproduce code, only explain the code usually leads to not being able to reproduce your issue locally

@oliverbytes
Copy link
Author

Hello!
Please, it is better if you provide a minimal reproduce code, only explain the code usually leads to not being able to reproduce your issue locally

Will do in a bit... thanks

@oliverbytes
Copy link
Author

oliverbytes commented Aug 9, 2020

Here's a minimal reproducible code

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

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    Get.put(AppController());
    return GetMaterialApp(home: HomeScreen());
  }
}

class HomeScreen extends StatelessWidget {
  const HomeScreen({Key key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text('Test')),
      body: Text('Test'),
    );
  }
}

class AppController extends GetxController {
  static AppController get to => Get.find();

  @override
  void onInit() async {
    Get.put(PostScreenController());
    super.onInit();
  }
}

class PostScreenController extends GetxController {
  final friendsController =
      Get.put(FriendsController(pickerMode: true), tag: 'sheet');
}

class FriendsController extends GetxController {
  final bool pickerMode;
  FriendsController({this.pickerMode = false});
}

The error

I/flutter ( 6323): [GETX] GetMaterialController has been initialized
I/flutter ( 6323): [GETX] GOING TO ROUTE /
E/flutter ( 6323): [ERROR:flutter/lib/ui/ui_dart_state.cc(166)] Unhandled Exception: NoSuchMethodError: The getter 'isInit' was called on null.
E/flutter ( 6323): Receiver: null
E/flutter ( 6323): Tried calling: isInit
E/flutter ( 6323): #0      Object.noSuchMethod  (dart:core-patch/object_patch.dart:51:5)
E/flutter ( 6323): #1      GetInstance.initDependencies 
package:get/…/instance/get_instance.dart:102
E/flutter ( 6323): #2      GetInstance.find 
package:get/…/instance/get_instance.dart:167
E/flutter ( 6323): #3      GetInstance.put 
package:get/…/instance/get_instance.dart:51
E/flutter ( 6323): #4      Inst.put 
package:get/…/instance/extension_instance.dart:23
E/flutter ( 6323): #5      new PostScreenController 
package:testing/main.dart:40
E/flutter ( 6323): #6      AppController.onInit 
package:testing/main.dart:33
E/flutter ( 6323): #7      DisposableInterface.onStart 
package:get/…/rx/rx_interface.dart:30
E/flutter ( 6323): #8      GetInstance.startController 
package:get/…/instance/get_instance.dart:128
E/flutter ( 6323): #9      GetInstance.initDependencies 
package:get/…/instance/get_instance.dart:104
E/flutter ( 6323): #10     GetInstance.find 
package:get/…/instance/get_instance.dart:167
E/flutter ( 6323): #11     GetInstance.put 
package:get/…/instance/get_instance.dart:51
E/flutter ( 6323): #12     Inst.put 
package:get/…/instance/extension_instance.dart:23
E/flutter ( 6323): #13     MyApp.build 
package:testing/main.dart:11
E/flutter ( 6323): #14     StatelessElement.build 
package:flutter/…/widgets/framework.dart:4620
E/flutter ( 6323): #15     ComponentElement.performRebuild 
package:flutter/…/widgets/framework.dart:4546
E/flutter ( 6323): #16     Element.rebuild 
package:flutter/…/widgets/framework.dart:4262
E/flutter ( 6323): #17     ComponentElement._firstBuild 
package:flutter/…/widgets/framework.dart:4525
E/flutter ( 6323): #18     ComponentElement.mount 
package:flutter/…/widgets/framework.dart:4520
E/flutter ( 6323): #19     Element.inflateWidget 
package:flutter/…/widgets/framework.dart:3490
E/flutter ( 6323): #20     Element.updateChild 
package:flutter/…/widgets/framework.dart:3258
E/flutter ( 6323): #21     RenderObjectToWidgetElement._rebuild 
package:flutter/…/widgets/binding.dart:1174
E/flutter ( 6323): #22     RenderObjectToWidgetElement.mount 
package:flutter/…/widgets/binding.dart:1145
E/flutter ( 6323): #23     RenderObjectToWidgetAdapter.attachToRenderTree.<anonymous closure> 
package:flutter/…/widgets/binding.dart:1087
E/flutter ( 6323): #24     BuildOwner.buildScope 
package:flutter/…/widgets/framework.dart:2620
E/flutter ( 6323): #25     RenderObjectToWidgetAdapter.attachToRenderTree 
package:flutter/…/widgets/binding.dart:1086
E/flutter ( 6323): #26     WidgetsBinding.attachRootWidget 
package:flutter/…/widgets/binding.dart:927
E/flutter ( 6323): #27     WidgetsBinding.scheduleAttachRootWidget.<anonymous closure> 
package:flutter/…/widgets/binding.dart:908
E/flutter ( 6323): #28     _rootRun  (dart:async/zone.dart:1182:47)
E/flutter ( 6323): #29     _CustomZone.run  (dart:async/zone.dart:1093:19)
E/flutter ( 6323): #30     _CustomZone.runGuarded  (dart:async/zone.dart:997:7)
E/flutter ( 6323): #31     _CustomZone.bindCallbackGuarded.<anonymous closure>  (dart:async/zone.dart:1037:23)
E/flutter ( 6323): #32     _rootRun  (dart:async/zone.dart:1190:13)
E/flutter ( 6323): #33     _CustomZone.run  (dart:async/zone.dart:1093:19)
E/flutter ( 6323): #34     _CustomZone.bindCallback.<anonymous closure>  (dart:async/zone.dart:1021:23)
E/flutter ( 6323): #35     Timer._createTimer.<anonymous closure>  (dart:async-patch/timer_patch.dart:18:15)
E/flutter ( 6323): #36     _Timer._runTimers  (dart:isolate-patch/timer_impl.dart:397:19)
E/flutter ( 6323): #37     _Timer._handleMessage  (dart:isolate-patch/timer_impl.dart:428:5)
E/flutter ( 6323): #38     _RawReceivePortImpl._handleMessage  (dart:isolate-patch/isolate_patch.dart:168:12)
E/flutter ( 6323):

@oliverbytes
Copy link
Author

It looks like it has something to do with the tag set to the FriendsController. Removing the tag fixes the error

@jonataslaw
Copy link
Owner

This has already been fixed by d208a61

I will update pub.dev soon.

@jonataslaw
Copy link
Owner

jonataslaw commented Aug 10, 2020

fix on 3.4.4

@oliverbytes
Copy link
Author

Great to hear! Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants