I'm parsing json from server and display it on screen. That is work when i parsing from localhost, but when i parsing from hosting there is an error like this
I/flutter (18089): [{"id":10,"reservation":"497538","order":"900000025301","equipment":"F6U-EA112","matcode":"6166357","description":"GASKET:2JKT;HE2;1302X1342X3MM;NASB\/CS","q_need":"1","q_available":"0","q_debt":"0","unit":"EA","location":"","required_date":null,"created_at":null,"updated_at":null},{"id":11,"reservation":"497538","order":"900000025301","equipment":"F6U-EA112","matcode":"6166345","description":"GASKET:2JKT;HE1;1302X1342X3MM;NASB\/CS","q_need":"1","q_available":"1","q_debt":"0","unit":"EA","location":"GD AUTOMOTIVE","required_date":null,"created_at":null,"updated_at":null},{"id":27,"reservation":"497566","order":"900000025329","equipment":"F6U-FA112","matcode":"6166298","description":"GASKET,SPW:IOR;24IN;150LB;GR;304\/304\/CS","q_need":"1","q_available":"0","q_debt":"0","unit":"EA","location":"GD AUTOMOTIVE","required_date":null,"created_at":null,"updated_at":null}]
E/flutter (18089): [ERROR:flutter/runtime/dart_isolate.cc(717)] Isolate (398792005) 'main.dart:_spawn()' exited with an error
E/flutter (18089): [ERROR:flutter/shell/common/shell.cc(184)] Dart Error: Unhandled exception:
E/flutter (18089): type 'String' is not a subtype of type 'int'
E/flutter (18089): #0 new Matl.fromJson (package:tams/model/material.dart:49:26)
E/flutter (18089): #1 parseMatl.<anonymous closure> (package:tams/services/material.dart:22:42)
E/flutter (18089): #2 MappedListIterable.elementAt (dart:_internal/iterable.dart:414:29)
E/flutter (18089): #3 ListIterable.toList (dart:_internal/iterable.dart:219:19)
E/flutter (18089): #4 parseMatl (package:tams/services/material.dart:22:58)
E/flutter (18089): #5 _IsolateConfiguration.apply (package:flutter/src/foundation/isolates.dart:88:16)
E/flutter (18089): #6 _spawn.<anonymous closure> (package:flutter/src/foundation/isolates.dart:96:30)
E/flutter (18089): #7 Timeline.timeSync (dart:developer/timeline.dart:168:22)
E/flutter (18089): #8 _spawn (package:flutter/src/foundation/isolates.dart:93:12)
E/flutter (18089): #9 _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:292:17)
E/flutter (18089): #10 _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)
thanks.
i found it.
it because there is different json response from localhost and shared host
localhost
[{"id":10,"reservation":497538,"order":900000025301,"equipment":"F6U-EA112","matcode":6166357,"description":"GASKET:2JKT;HE2;1302X1342X3MM;NASB\/CS","q_need":1,"q_available":0,"q_debt":0,"unit":"EA","location":"","required_date":null,"created_at":null,"updated_at":null},{"id":11,"reservation":497538,"order":900000025301,"equipment":"F6U-EA112","matcode":6166345,"description":"GASKET:2JKT;HE1;1302X1342X3MM;NASB\/CS","q_need":1,"q_available":1,"q_debt":0,"unit":"EA","location":"GD AUTOMOTIVE","required_date":null,"created_at":null,"updated_at":null},{"id":27,"reservation":497566,"order":900000025329,"equipment":"F6U-FA112","matcode":6166298,"description":"GASKET,SPW:IOR;24IN;150LB;GR;304\/304\/CS","q_need":1,"q_available":0,"q_debt":0,"unit":"EA","location":"GD AUTOMOTIVE","required_date":null,"created_at":null,"updated_at":null}]
shared host
[{"id":10,"reservation":"497538","order":"900000025301","equipment":"F6U-EA112","matcode":"6166357","description":"GASKET:2JKT;HE2;1302X1342X3MM;NASB\/CS","q_need":"1","q_available":"0","q_debt":"0","unit":"EA","location":"","required_date":null,"created_at":null,"updated_at":null},{"id":11,"reservation":"497538","order":"900000025301","equipment":"F6U-EA112","matcode":"6166345","description":"GASKET:2JKT;HE1;1302X1342X3MM;NASB\/CS","q_need":"1","q_available":"1","q_debt":"0","unit":"EA","location":"GD AUTOMOTIVE","required_date":null,"created_at":null,"updated_at":null},{"id":27,"reservation":"497566","order":"900000025329","equipment":"F6U-FA112","matcode":"6166298","description":"GASKET,SPW:IOR;24IN;150LB;GR;304\/304\/CS","q_need":"1","q_available":"0","q_debt":"0","unit":"EA","location":"GD AUTOMOTIVE","required_date":null,"created_at":null,"updated_at":null}]
Related
I am trying to use firebase OTP verification
I get this error when sending firebase OTP it was working
but suddenly this error appears
E/FirebaseAuth(17209): [SmsRetrieverHelper] SMS verification code request failed: unknown status code: 17499 API key not valid. Please pass a valid API key.
E/flutter (17209): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Null' is not a subtype of type 'String'
E/flutter (17209): #0 MethodChannelFirebaseAuth.verifyPhoneNumber.<anonymous closure> (package:firebase_auth_platform_interface/src/method_channel/method_channel_firebase_auth.dart:660:35)
E/flutter (17209): #1 _RootZone.runUnaryGuarded (dart:async/zone.dart:1586:10)
E/flutter (17209): #2 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter (17209): #3 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
E/flutter (17209): #4 _ForwardingStreamSubscription._add (dart:async/stream_pipe.dart:123:11)
E/flutter (17209): #5 _HandleErrorStream._handleData (dart:async/stream_pipe.dart:253:10)
E/flutter (17209): #6 _ForwardingStreamSubscription._handleData (dart:async/stream_pipe.dart:153:13)
E/flutter (17209): #7 _RootZone.runUnaryGuarded (dart:async/zone.dart:1586:10)
E/flutter (17209): #8 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:339:11)
E/flutter (17209): #9 _DelayedData.perform (dart:async/stream_impl.dart:515:14)
E/flutter (17209): #10 _PendingEvents.handleNext (dart:async/stream_impl.dart:620:11)
E/flutter (17209): #11 _PendingEvents.schedule.<anonymous closure> (dart:async/stream_impl.dart:591:7)
E/flutter (17209): #12 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
E/flutter (17209): #13 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
How to solve that ?
The error is coming from the package
The error is coming from line 135
This is the warning I get from my debug console
This happens as the carousel slides
E/flutter (13716): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: Null
check operator used on a null value
E/flutter (13716): #0 CarouselSliderState.getTimer.<anonymous closure>
package:carousel_slider/carousel_slider.dart:135
E/flutter (13716): #1 _rootRunUnary (dart:async/zone.dart:1436:47)
E/flutter (13716): #2 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (13716): #3 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter (13716): #4 _CustomZone.bindUnaryCallbackGuarded.<anonymous closure>
(dart:async/zone.dart:1281:26)
E/flutter (13716): #5 _rootRunUnary (dart:async/zone.dart:1444:13)
E/flutter (13716): #6 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (13716): #7 _CustomZone.bindUnaryCallback.<anonymous closure>
(dart:async/zone.dart:1265:26)
E/flutter (13716): #8 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:395:19)
E/flutter (13716): #9 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:426:5)
E/flutter (13716): #10 _RawReceivePortImpl._handleMessage (dart:isolate-
patch/isolate_patch.dart:192:12)
E/flutter (13716):
According to the error and the screenshot, either carouselState, pageController or page is null, and you are using null check operator (!) to say that these variables can not be null. You can check these variables if they are null or not. Or you can use nullable operator (?) instead of null check operator (!).
I'm having a file containing multiple data in different rows, where in the first row is having some of the ANSI values and the other rows is having UTF-8 related values.
I was hoping to extract only the first row and decode the ANSI value with the help of the ascii.decoder and in the other rows with the help of utf-8.decoder.
I successfully did the decode when i removed the first row from the csv file manually and vice versa but how to do that programmatically?
This is what I'm trying to do
final ackFile = File(entities[i].path).openRead(); //To read the file
final ackFields = await ackFile.transform(utf8.decoder).transform(const CsvToListConverter()).toList(); //To extract it I'm getting error
//also here
final ackFile = File(entities[i].path).openRead().transform(utf8.decoder).transform(LineSplitter()).forEach((element) => print("Element is $element")); //When trying to read the csv file line by line
I'm getting an error stating as
I/flutter (22362): The supplied value (512.000000pt) will be discarded and treated as if it had not been specified.
E/flutter (22362): [ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: FormatException: Unexpected extension byte (at offset 82)
E/flutter (22362): #0 _Utf8Decoder.convertChunked (dart:convert-patch/convert_patch.dart:1893:7)
E/flutter (22362): #1 _Utf8ConversionSink.addSlice (dart:convert/string_conversion.dart:314:28)
E/flutter (22362): #2 _Utf8ConversionSink.add (dart:convert/string_conversion.dart:310:5)
E/flutter (22362): #3 _ConverterStreamEventSink.add (dart:convert/chunked_conversion.dart:72:18)
E/flutter (22362): #4 _SinkTransformerStreamSubscription._handleData (dart:async/stream_transformers.dart:111:24)
E/flutter (22362): #5 _rootRunUnary (dart:async/zone.dart:1436:47)
E/flutter (22362): #6 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (22362): #7 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7)
E/flutter (22362): #8 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11)
E/flutter (22362): #9 _BufferingStreamSubscription._add (dart:async/stream_impl.dart:271:7)
E/flutter (22362): #10 _SyncStreamControllerDispatch._sendData (dart:async/stream_controller.dart:733:19)
E/flutter (22362): #11 _StreamController._add (dart:async/stream_controller.dart:607:7)
E/flutter (22362): #12 _StreamController.add (dart:async/stream_controller.dart:554:5)
E/flutter (22362): #13 _FileStream._readBlock.<anonymous closure> (dart:io/file_impl.dart:98:19)
E/flutter (22362): #14 _rootRunUnary (dart:async/zone.dart:1436:47)
E/flutter (22362): #15 _CustomZone.runUnary (dart:async/zone.dart:1335:19)
E/flutter (22362): <asynchronous suspension>
E/flutter (22362):
I'm trying to unzip a password-protected zip file in Flutter. But got an error:
Unhandled Exception: FormatException: Invalid uncompressed block header
The codes:
import 'package:archive/archive_io.dart';
...
extractFileToDisk(path + "/a.zip", path, password: "a_password");
...
The complete log:
E/flutter (11745): #0 Inflate._parseUncompressedBlock (package:archive/src/zlib/inflate.dart:198:7)
E/flutter (11745): #1 Inflate._parseBlock (package:archive/src/zlib/inflate.dart:116:9)
E/flutter (11745): #2 Inflate._inflate (package:archive/src/zlib/inflate.dart:92:20)
E/flutter (11745): #3 new Inflate.buffer (package:archive/src/zlib/inflate.dart:22:5)
E/flutter (11745): #4 ArchiveFile.decompress (package:archive/src/archive_file.dart:76:28)
E/flutter (11745): #5 ArchiveFile.content (package:archive/src/archive_file.dart:67:7)
E/flutter (11745): #6 extractFileToDisk (package:archive/src/io/extract_archive_to_disk.dart:67:29)
E/flutter (11745): #7 _MyHomePageState.initState.extractFile (package:my_project/main.dart:116:9)
Does anyone know how to fix this?
I am not getting output on my app and it should have give a output like many question is how to sisplay json data in my flutter app
class AppState extends State<AppName>{
var name ;
var email ;
int cgpa ;
TextEditingController user = new TextEditingController();
String url = 'http://10.42.0.243:8000/students/';
getData(String username) async{
String profile = url+'?search='+username;
var res = await http.get(profile,headers: {"Accept":"application/json"});
print(res.body);
debugPrint(res.body);
var resBody = json.decode(res.body);
name = resBody['sname'].toString();
email = resBody['email'].toString();
cgpa = resBody['cgpa'] ;
debugPrint(name);
setState(() {
print("Success");
});
}
my app screenshot is
JSON Data Screenshot
Error output:
Performing hot reload...
Syncing files to device Moto G 5 Plus...
Reloaded 0 of 576 libraries in 389ms.
E/BpSurfaceComposerClient(28411): Failed to transact (-1)
E/BpSurfaceComposerClient(28411): Failed to transact (-1)
I/flutter (28411): [{"id":1,"sname":"Ashutosh Lokhande","email":"2016bit053#sggs.ac.in","year":"2016","cgpa":7.2}]
I/flutter (28411): [{"id":1,"sname":"Ashutosh Lokhande","email":"2016bit053#sggs.ac.in","year":"2016","cgpa":7.2}]
E/flutter (28411): [ERROR:flutter/lib/ui/ui_dart_state.cc(148)] Unhandled Exception: type 'String' is not a subtype of type 'int' of 'index'
E/flutter (28411): #0 AppState.getData (package:json_flutter/main.dart:28:19)
E/flutter (28411):
E/flutter (28411): #1 AppState.build. (package:json_flutter/main.dart:56:34)
E/flutter (28411): #2 _InkResponseState._handleTap (package:flutter/src/material/ink_well.dart:654:14)
E/flutter (28411): #3 _InkResponseState.build. (package:flutter/src/material/ink_well.dart:729:32)
E/flutter (28411): #4 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:182:24)
E/flutter (28411): #5 TapGestureRecognizer._checkUp (package:flutter/src/gestures/tap.dart:365:11)
E/flutter (28411): #6 TapGestureRecognizer.handlePrimaryPointer (package:flutter/src/gestures/tap.dart:275:7)
E/flutter (28411): #7 PrimaryPointerGestureRecognizer.handleEvent (package:flutter/src/gestures/recognizer.dart:455:9)
E/flutter (28411): #8 PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:75:13)
E/flutter (28411): #9 PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:102:11)
E/flutter (28411): #10 GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:218:19)
E/flutter (28411): #11 GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:198:22)
E/flutter (28411): #12 GestureBinding._handlePointerEvent (package:flutter/src/gestures/binding.dart:156:7)
E/flutter (28411): #13 GestureBinding._flushPointerEventQueue (package:flutter/src/gestures/binding.dart:102:7)
E/flutter (28411): #14 GestureBinding._handlePointerDataPacket (package:flutter/src/gestures/binding.dart:86:7)
E/flutter (28411): #15 _rootRunUnary (dart:async/zone.dart:1136:13)
E/flutter (28411): #16 _CustomZone.runUnary (dart:async/zone.dart:1029:19)
E/flutter (28411): #17 _CustomZone.runUnaryGuarded (dart:async/zone.dart:931:7)
E/flutter (28411): #18 _invoke1 (dart:ui/hooks.dart:263:10)
E/flutter (28411): #19 _dispatchPointerDataPacket (dart:ui/hooks.dart:172:5)
E/flutter (28411):