imsujan276 / shopify_flutter

A flutter package that works as a bridge between your Shopify Store and Flutter Application
https://pub.dev/packages/shopify_flutter
MIT License
26 stars 27 forks source link

I'm getting an type casting error in cart. #102

Closed rishabhmishra208 closed 4 weeks ago

rishabhmishra208 commented 1 month ago

type 'Null' is not a subtype of type 'String' in type cast

import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:shopify_flutter/models/src/checkout/mailing_address/mailing_address.dart';

part 'customer.freezed.dart';
part 'customer.g.dart';

@freezed

/// The cart customer
class Customer with _$Customer {
  const Customer._();

  /// The cart customer constructor
  factory Customer({
    required String? id,
    required String email,
    required String phone,
    required String firstName,
    required String lastName,
    required String displayName,
    required MailingAddress? defaultAddress,
    required dynamic numberOfOrders,
    required bool? acceptsMarketing,
  }) = _Customer;

  /// The cart customer from json
  factory Customer.fromJson(Map<String, dynamic> json) =>
      _$CustomerFromJson(json);
}

Phone number is require field and we getting this null from API so I don't think all the field is required from model because we don't know which field is getting null from API. Please fix it ASAP.

imsujan276 commented 4 weeks ago

The issue has been fixed nad is available in v2.2.7