فلاتر کارای عزیز
موقع لاگین این خطا رو میده
E/flutter (14234): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: The getter 'length' was called on null.
E/flutter (14234): Receiver: null
E/flutter (14234): Tried calling: length
E/flutter (14234): #0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
E/flutter (14234): #1 _Uri._uriEncode (dart:core/runtime/liburi_patch.dart:44:23)
E/flutter (14234): #2 Uri.encodeQueryComponent (dart:core/uri.dart:1098:17)
E/flutter (14234): #3 mapToQuery.<anonymous closure> (package:http/src/utils.dart:19:13)
E/flutter (14234): #4 CastMap.forEach.<anonymous closure> (dart:_internal/cast.dart:286:8)
E/flutter (14234): #5 __InternalLinkedHashMap&_HashVMBase&MapMixin&_LinkedHashMapMixin.forEach (dart:collection/runtime/libcompact_hash.dart:367:8)
E/flutter (14234): #6 CastMap.forEach (dart:_internal/cast.dart:285:13)
E/flutter (14234): #7 mapToQuery (package:http/src/utils.dart:17:7)
E/flutter (14234): #8 Request.bodyFields= (package:http/src/request.dart:128:17)
E/flutter (14234): #9 BaseClient._sendUnstreamed (package:http/src/base_client.dart:163:17)
E/flutter (14234): <asynchronous suspension>
E/flutter (14234): #10 BaseClient.post (package:http/src/base_client.dart:54:7)
E/flutter (14234): #11 post.<anonymous closure> (package:http/http.dart:70:16)
E/flutter (14234): #12 _withClient (package:http/http.dart:166:20)
E/flutter (14234): <asynchronous suspension>
E/flutter (14234): #13 post (package:http/http.dart:69:5)
E/flutter (14234): #14 AuthController.login (package:pol_kar/Classes/auth_controller.dart:9:28)
E/flutter (14234): <asynchronous suspension>
E/flutter (14234): #15 LoginPageState.build.<anonymous closure> (package:pol_kar/Pagese/login_page.dart:50:59)
E/flutter (14234): <asynchronous suspension>
E/flutter (14234): #16 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:513:14)
E/flutter (14234): #17 _InkResponseState.build.<anonymous closure> (package:flutter/src/material/ink_well.dart:568:30)
E/flutter (14234): #18 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:120:24)
E/flutter (14234): #19 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:242:9)
E/flutter (14234): #20 TapGestureRecognizer.acceptGesture (package:flutter/src/gestures/tap.dart:204:7)
E/flutter (14234): #21 GestureArenaManager.sweep (package:flutter/src/gestures/arena.dart:156:27)
E/flutter (14234): #22 _WidgetsFlutterBinding&BindingBase&GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:20)
E/flutter (14234): #23 _WidgetsFlutterBinding&BindingBase&GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:192:22)
E/flutter (14234): #24 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:149:7)
E/flutter (14234): #25 _WidgetsFlutterBinding&BindingBase&GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:101:7)
E/flutter (14234): #26 _WidgetsFlutterBinding&BindingBase&GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:85:7)
E/flutter (14234): #27 _rootRunUnary (dart:async/zone.dart:1136:13)
E/flutter (14234): #28 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter (14234): #29 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
E/flutter (14234): #30 _invoke1 (dart:ui/hooks.dart:223:10)
E/flutter (14234): #31 _dispatchPointerDataPacket (dart:ui/hooks.dart:144:5)
اینم فایل auth
class AuthController {
final String globalUrl = 'http://185.105.187.218/v1';
Future<Map> login(Map body) async {
final response = await http.post(
'$globalUrl/login', body: body);
var responseData = json.decode(response.body);
return responseData;
}
}
و به این شکل ازش استفاده کردم
Map response = await new AuthController().login({'username' : username , 'password' : password});
بنظرتون مشکل چی میتونه باشه
به مهدی کمک کنید تا مشکل خودش را حل کند؛ اینطور میتوانیم با هم پیشرفت کنیم.
آیا مایل به ارسال نوتیفیکیشن و اخبار از طرف راکت هستید ؟