flyerhq/flutter_firebase_chat_core

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Null check operator used on a null value.

infinite-dev22 opened this issue · 5 comments

What bug do you experience? 🐞

When trying to create a room,I get an error: Null check operator used on a null value.

How can it be reproduced? 🤔

  1. Create a User.
  2. Create a room.
  3. Error occurs at Step 2.

What behavior is expected? 💡

A new chat room is created.


Screenshots or videos 📸

Screenshot from 2023-09-13 01-01-35

Code snippets 📝

types.User user = types.User(
  firstName: userProfile.name,
  id: userProfile.userId, // UID from Firebase Authentication
  imageUrl: userProfile.profilePicture,
  lastName: '',
);

await FirebaseChatCore.instance.createUserInFirestore(user);

final room = await FirebaseChatCore.instance.createRoom(user, metadata: { // Error occurs here.
  'imageUrl': userProfile.profilePicture,
  'name': userProfile.name,
  'listingId': widget.listing.id,
  'listingName': widget.listing.name,
});

Environment info

Please specify the flutter, flutter_firebase_chat_core versions.

flutter: 3.13.0
flutter_firebase_chat_core: 1.6.7

flutter doctor -v output 👇

[✓] Flutter (Channel stable, 3.13.0, on Ubuntu Mantic Minotaur (development branch) 6.5.1-060501-generic, locale en_US.UTF-8)
    • Flutter version 3.13.0 on channel stable at /home/infinite/snap/flutter/common/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision efbf63d9c6 (4 weeks ago), 2023-08-15 21:05:06 -0500
    • Engine revision 1ac611c64e
    • Dart version 3.1.0
    • DevTools version 2.25.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.2)
    • Android SDK at /home/infinite/Android/Sdk
    • Platform android-33, build-tools 33.0.2
    • Java binary at: /home/infinite/.local/share/JetBrains/Toolbox/apps/android-studio/jbr/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.8+0-17.0.8b1000.8-10699129)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at google-chrome

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4ubuntu1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[✓] Android Studio (version 2023.2)
    • Android Studio at /home/infinite/.local/share/JetBrains/Toolbox/apps/android-studio
    • Flutter plugin version 75.1.4
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.8+0-17.0.8b1000.8-10699129)

[✓] IntelliJ IDEA Community Edition (version 2023.2)
    • IntelliJ at /home/infinite/.local/share/JetBrains/Toolbox/apps/intellij-idea-community-edition
    • 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

[✓] VS Code (version 1.82.1)
    • VS Code at /usr/share/code
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • F 04K (mobile)  • 578024c9 • android-arm64  • Android 10 (API 29)
    • Linux (desktop) • linux    • linux-x64      • Ubuntu Mantic Minotaur (development branch) 6.5.1-060501-generic
    • Chrome (web)    • chrome   • web-javascript • Google Chrome 116.0.5845.187

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

• No issues found!

Platform

Device (e.g. Android emulator, iOS simulator, Samsung Galaxy S21): Fujitsu F 04K

OS version (e.g. iOS 14.5, Android 11): Android 10

same issue. Any news ?

I am working on a new chat UI version with a complete from scratch refactor, and this repo will become an example on how to use chat UI with Firebase. The package itself will be discontinued, since it does not make sense - core of the package is like 100 lines, if we remove all the customisation.

same issue

any update on this ?

I had a similar issue, although likely not the same, but it was caused by the code not being able to get the user out of firebase.