Skip to content

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

Closed
@Nidal-Bakir

Description

@Nidal-Bakir

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions