firebase-tools icon indicating copy to clipboard operation
firebase-tools copied to clipboard

[Data Connect] Cannot reset nullable column to null for Float & Int data types in Flutter

Open faisalramdan17 opened this issue 6 months ago • 1 comments

[REQUIRED] Environment info

firebase-tools:

  • Firebase Data Connect VS Code/Windsurf Extension: Version 1.4.0
  • Flutter: firebase_data_connect: ^0.1.4+1

Platform: Flutter : iOS/Android

[REQUIRED] Test case

type Event @table {
  # Auto-generated UUID for new events
  id: UUID! @default(expr: "uuidV4()")
  title: String! @col(dataType: "varchar(255)")
  description: String
  regularPrice: Float!
  vipPrice: Float
}
mutation UpdateEvent(
  $id: UUID!,
  $title: String,
  $description: String,
  $regularPrice: Float,
  $vipPrice: Float,
) @auth(level: USER) {
  event_update(
    key: { id: $id },
    data: {
      title: $title,
      description: $description,
      regularPrice: $regularPrice,
      vipPrice: $vipPrice,
    }
  )
}

This params when call :

class EditEventParams {
  final String eventId;
  final String? title;
  final String? description;
  final double? regularPrice;
  final double? vipPrice;

  EditEventParams({
    required this.eventId,
    this.title,
    this.description,
    this.regularPrice,
    this.vipPrice,
  });
}

[REQUIRED] Steps to reproduce

Set: params.vipPrice = null

Then call:

PentastixConnector.instance.updateEvent(id: params.eventId)
        .title(params.title)
        .description(params.description)
        .regularPrice(params.regularPrice)
        .vipPrice(params.vipPrice)
        .execute();

[REQUIRED] Expected behavior

vipPrice should be null

[REQUIRED] Actual behavior

Error is only happened for Float & Int data types.

ERROR:
DataConnectOperationError ([Data Connect/DataConnectErrorCode.other] failed to invoke operation: [Instance of 'DataConnectOperationFailureResponseErrorInfo'])
 #0      handleResponse (package:firebase_data_connect/src/network/grpc_transport.dart:197:5)
      #1      GRPCTransport.invokeMutation (package:firebase_data_connect/src/network/grpc_transport.dart:158:14)
grpc_transport.dart:158
      <asynchronous suspension>
      #2      MutationRef._executeOperation (package:firebase_data_connect/src/core/ref.dart:253:17)
ref.dart:253
      <asynchronous suspension>
      #3      MutationRef.execute (package:firebase_data_connect/src/core/ref.dart:238:11)
ref.dart:238
      <asynchronous suspension>
      #4      FutureObjectExtension.asFutureResult (package:corekit/tools/extensions/future_object_extension.dart:43:22)

faisalramdan17 avatar May 18 '25 20:05 faisalramdan17

Hey @faisalramdan17, thanks for reporting this! I'm able to reproduce the issue. Let me raise this to our engineering team so they can take a look. I'll also mark this as reproducible.

Sharing the mcve here.

aalej avatar May 20 '25 15:05 aalej

Closing as this should be fixed in https://github.com/firebase/flutterfire/pull/17373

maneesht avatar Aug 01 '25 20:08 maneesht