Skip to content

[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: NoSuchMethodError: The method 'matchAsPrefix' was called on null. #584

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

Closed
shreyash333 opened this issue Mar 29, 2021 · 1 comment

Comments

@shreyash333
Copy link

shreyash333 commented Mar 29, 2021

Hover doctor

[√] Flutter (Channel beta, 1.26.0-17.6.pre, on Microsoft Windows [Version 10.0.19041.867], locale en-US)
• Flutter version 1.26.0-17.6.pre at C:\flutter
• Framework revision a29104a69b (6 weeks ago), 2021-02-16 09:26:56 -0800
• Engine revision 21fa8bb99e
• Dart version 2.12.0 (build 2.12.0-259.12.beta)

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at C:\Users\Asus\AppData\Local\Android\sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.1.0)
• Android Studio at C:\Program Files\Android\Android Studio
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.54.3)
• VS Code at C:\Users\Asus\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.20.0

[√] Connected device (3 available)
• AOSP on IA Emulator (mobile) • emulator-5554 • android-x86 • Android 9 (API 28) (emulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 89.0.4389.90
• Edge (web) • edge • web-javascript • Microsoft Edge 89.0.774.57

$ hover doctor
hover: Running on linux
hover: Docker installed: true
hover: Sharing flutter version
[...]

Error output

[ERROR:flutter/lib/ui/ui_dart_state.cc(186)] Unhandled Exception: NoSuchMethodError: The method 'matchAsPrefix' was called on null.
E/flutter (14919): Receiver: null
Tried calling: matchAsPrefix("application/x-www-form-urlencoded", 0)
E/flutter (14919): #0 StringScanner.matches (package:string_scanner/src/string_scanner.dart:171:26)
E/flutter (14919): #1 StringScanner.scan (package:string_scanner/src/string_scanner.dart:128:21)
E/flutter (14919): #2 new MediaType.parse. (package:http_parser/src/media_type.dart:48:17)
E/flutter (14919): #3 wrapFormatException (package:http_parser/src/utils.dart:13:16)
E/flutter (14919): #4 new MediaType.parse (package:http_parser/src/media_type.dart:46:7)
E/flutter (14919): #5 Request._contentType (package:http/src/request.dart:157:22)
E/flutter (14919): #6 Request.encoding= (package:http/src/request.dart:62:23)
E/flutter (14919): #7 BaseClient._sendUnstreamed (package:http/src/base_client.dart:78:35)
E/flutter (14919): #8 BaseClient.post (package:http/src/base_client.dart:32:7)
E/flutter (14919): #9 post. (package:http/http.dart:70:16)
E/flutter (14919): #10 _withClient (package:http/http.dart:166:20)
E/flutter (14919): #11 post (package:http/http.dart:69:5)

@shreyash333
Copy link
Author

Map<String, dynamic> jsonMap = {
"token": jwttoken,
"student_id": user.student_id.toString()
};

var res = await http.post('http://10.0.2.2:12345/getCurrentDB',
    body: jsonMap,
    headers: {
      "Accept": "application/json",
      "Content-Type": "application/x-www-form-urlencoded"
    },
    encoding: Encoding.getByName("utf-8"));

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

No branches or pull requests

1 participant