Skip to content

Exception: type 'Null' is not a subtype of type 'String' in type cast on v.5.2.0 only on iOS #738

Description

@akarapetsas

‼️ Required data ‼️

Do not remove any of the steps from the template below. If a step is not applicable to your issue, please leave that step empty.

There are a lot of things that can contribute to things not working. Having a very basic understanding of your environment will help us understand your issue faster!

Environment

  • [ ✓] Output of flutter doctor
    [✓] Flutter (Channel stable, 3.10.5, on macOS 13.4 22F66 darwin-arm64, locale en-DE)
    • Flutter version 3.10.5 on channel stable at /opt/homebrew/Caskroom/flutter/3.7.6/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 796c8ef792 (11 days ago), 2023-06-13 15:51:02 -0700
    • Engine revision 45f6e00911
    • Dart version 3.0.5
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
• Android SDK at /Users/alexioskarapetsas/Library/Android/sdk
• Platform android-33, build-tools 33.0.2
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 14E300c
• CocoaPods version 1.12.0

[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] Connected device (3 available)
• iPhone (mobile) • 00008101-000649190198001E • ios • iOS 16.5.1 20F75
• macOS (desktop) • macos • darwin-arm64 • macOS 13.4 22F66 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 114.0.5735.133

[✓] Network resources
• All expected network resources are available.

• No issues found!
Process finished with exit code 0

  • [✓] Version of purchases-flutter => 5.2.0
  • [✓] Testing device version e.g.: iOS 16.5.1
  • [✓ ] How often the issue occurs- every one of your customers is impacted? Only in dev? Constantly both on dev and prod
  • [✓ ] Debug logs that reproduce the issue
  • [✓ ] Steps to reproduce, with a description of expected vs. actual behavior
    Other information (e.g. stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, etc.)

Stacktrace:
2023-06-25 10:28:04.722650+0200 Runner[2247:349369] [VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: type 'Null' is not a subtype of type 'String' in type cast
#0 new LinkedHashMap.from. (dart:collection/linked_hash_map.dart:187)
#1 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:625)
#2 new LinkedHashMap.from (dart:collection/linked_hash_map.dart:186)
#3 _$$_CustomerInfoFromJson (package:purchases_flutter/models/customer_info_wrapper.g.dart:12)
#4 new _$_CustomerInfo.fromJson (package:purchases_flutter/models/customer_info_wrapper.freezed.dart:332)
#5 _$CustomerInfoFromJson (package:purchases_flutter/models/customer_info_wrapper.freezed.dart:18)
#6 new CustomerInfo.fromJson (package:purchases_flutter/models/customer_info_wrapper.dart:66)
#7 Purchases.getCustomerInfo (package:purchases_flutter/purchases_flutter.dart:561)

#8 Payments.isUserPremium (package:flutter_app/utils/payments.dart:23)

#9 Utils.canAccessContent (package:flutter_app/utils/utils.dart:16)

#10 _ContentRowWidgetState.build.. (package:flutter_app/utils/column_audio_list.dart:77)

Describe the bug

I've updated the purchases_flutter package and I constantly get the exception described on the stacktrace above. And I can't get the info for the user on iOS (if has bought subscription etc). On android it works fine though.

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions