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

NoSuchMethodError: The method 'openUrl' was called on null. #191

Closed
ottomated opened this issue Aug 16, 2018 · 7 comments
Closed

NoSuchMethodError: The method 'openUrl' was called on null. #191

ottomated opened this issue Aug 16, 2018 · 7 comments
Assignees
Labels
closed-as-intended Closed as the reported issue is expected behavior type-question A question about expected behavior or functionality

Comments

@ottomated
Copy link

ottomated commented Aug 16, 2018

Expected

http.Client() should make a request

Behavior

When making a request a minute or two after a client is opened, it errors with the following stacktrace:

E/flutter (12367): NoSuchMethodError: The method 'openUrl' was called on null.
E/flutter (12367): Receiver: null
E/flutter (12367): Tried calling: openUrl("PUT", Instance of '_SimpleUri')
E/flutter (12367): #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:46:5)
E/flutter (12367): #1 IOClient.send (package:http/src/io_client.dart:30:36)
E/flutter (12367):
E/flutter (12367): #2 BaseClient._sendUnstreamed (package:http/src/base_client.dart:171:38)
E/flutter (12367):
E/flutter (12367): #3 BaseClient.put (package:http/src/base_client.dart:78:5)
E/flutter (12367): #4 _myFunction.. (file://main.dart:XXXX:XX)
E/flutter (12367): #5 _RootZone.runUnary (dart:async/zone.dart:1381:54)
E/flutter (12367): #6 _FutureListener.handleValue (dart:async/future_impl.dart:129:18)
E/flutter (12367): #7 Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:633:45)
E/flutter (12367): #8 Future._propagateToListeners (dart:async/future_impl.dart:662:32)
E/flutter (12367): #9 Future._completeWithValue (dart:async/future_impl.dart:477:5)
E/flutter (12367): #10 Future._asyncComplete. (dart:async/future_impl.dart:507:7)
E/flutter (12367): #11 _microtaskLoop (dart:async/schedule_microtask.dart:41:21)
E/flutter (12367): #12 _startMicrotaskLoop (dart:async/schedule_microtask.dart:50:5)
E/flutter (12367): #13 _Timer._runTimers (dart:isolate/runtime/libtimer_impl.dart:391:30)
E/flutter (12367): #14 _Timer._handleMessage (dart:isolate/runtime/libtimer_impl.dart:416:5)
E/flutter (12367): #15 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:165:12)

My code is:

client.get("https://google.com").then((response) {
  print(response.body);
});

Environment

Flutter 0.5.1 • channel beta • https://github.com/flutter/flutter.git
Framework • revision c7ea3ca377 (3 months ago) • 2018-05-29 21:07:33 +0200
Engine • revision 1ed25ca7b7
Tools • Dart 2.0.0-dev.58.0.flutter-f981f09760```
@ghost
Copy link

ghost commented Aug 23, 2018

I can't replicate the issue with this minimal example:

import 'package:http/http.dart' as http;

main() {
  var client = new http.Client();
  client.get("https://google.com")
      .then((response) {
        print(response.body);
      });
}

However, I see you're working with Flutter, and one that seems a little old.
Have you tried updating the various packages to the latest version and checked if the issue persists?
With the recent launch of Dart 2.0 quite a lot of things have changed during the transition, so it's possible you've hit some bad combination of versions.

@ghost ghost assigned ottomated Aug 23, 2018
@ghost ghost added the needs info label Aug 23, 2018
@rakeshlanjewar
Copy link

seen this issue in flutter

@zoechi
Copy link

zoechi commented Jan 27, 2019

@rakeshlanjewarwork can you please provide more information.
As mentioned above there is no way to reproduce. Without reproduction there is no way to fix.

@samsoft00
Copy link

Having the same issue when i make http GET request call, how do you resolve it @ottomated ? thanks

@natebosch
Copy link
Member

Are you calling .close() on the Client instance? That makes the client unusable for further requests...

@samsoft00
Copy link

Change the http library to dio, simple but powerful.
https://pub.dartlang.org/packages/dio/versions/2.1.0

@natebosch natebosch added type-question A question about expected behavior or functionality closed-as-intended Closed as the reported issue is expected behavior and removed need-info labels Mar 15, 2019
@Nico04
Copy link

Nico04 commented Sep 7, 2019

I had the same issue, a full restart of the debugged app solved it.

Edit : it turns out it was my code, I disposed it and tried to use it again (quite difficult to find out)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-as-intended Closed as the reported issue is expected behavior type-question A question about expected behavior or functionality
Projects
None yet
Development

No branches or pull requests

6 participants