Parse-SDK-Flutter
Parse-SDK-Flutter copied to clipboard
Type 'Null' is not a subtype of type 'String'
New Issue Checklist
- [x] I am not disclosing a vulnerability.
- [x] I am not just asking a question.
- [x] I have searched through existing issues.
- [x] I can reproduce the issue with the latest version of Parse Server and the Parse Flutter SDK.
Issue Description
I'm using parse dio client. When there is no internet connection (disabled wifi and LTE) and trying to do any operation with the parse server like (create or update or any operation from the ParseClient
class)
The dio throws a DioError
and in the SDK we convert the error to ParseNetworkResponse
https://github.com/parse-community/Parse-SDK-Flutter/blob/af76c6b74fcb4d7e60d798a028e207246d4f8b19/packages/dart/lib/src/network/parse_dio_client.dart#L86-L89
And here is the bug the data
property in error.response
is null.
so the next exception will be thrown:
Type 'Null' is not a subtype of type 'String'
Steps to reproduce
-
init the Parse SDK with dio client
-
Disable wifi and LTE (cut off the internet of the device)
-
invoke
create
operation on parse object
Actual Outcome
_TypeError (type 'Null' is not a subtype of type 'String') [log] #0 ParseDioClient.post package:parse_server_sdk/…/network/parse_dio_client.dart:88
#1 ParseObject.create package:parse_server_sdk/…/objects/parse_object.dart:71 #2 ChatRemoteDataSourceImpl.sendNewMessage package:doors/…/data_source/chat_remote_data_source.dart:76 #3 SendTextMessageProcessManager._startSendingProcess package:doors/…/process/send_text_message_process_manager.dart:69 #4 SendTextMessageBloc._onMessageSended package:doors/…/send_text_message_bloc/send_text_message_bloc.dart:45 #5 new SendTextMessageBloc. . package:doors/…/send_text_message_bloc/send_text_message_bloc.dart:24 #6 new SendTextMessageBloc. package:doors/…/send_text_message_bloc/send_text_message_bloc.dart:23 #7 Bloc.on. .handleEvent package:bloc/src/bloc.dart:211
Expected Outcome
ParseResponse
with error
Environment
Flutter version: 2.10.2
android emulator with android version: 9
Parse Flutter SDK
- SDK version:
3.1.2
- Operating system version:
Ubuntu 20.04.4 LTS x86_64
Server
- Parse Server version:
4.5.0
Thanks for opening this issue!
- 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.