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

Type 'Null' is not a subtype of type 'String' #774

Closed
4 tasks done
Nidal-Bakir opened this issue Jul 9, 2022 · 1 comment · Fixed by #825
Closed
4 tasks done

Type 'Null' is not a subtype of type 'String' #774

Nidal-Bakir opened this issue Jul 9, 2022 · 1 comment · Fixed by #825
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@Nidal-Bakir
Copy link
Member

New Issue Checklist

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

} on dio.DioError catch (error) {
return ParseNetworkResponse(
data: error.response?.data, statusCode: error.response!.statusCode!);
}

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
@parse-github-assistant
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
2 participants