Flutter - поток не соединяется с Firebase - PullRequest
0 голосов
/ 21 января 2020

Привет всем,

Я пытаюсь создать веб-приложение с трепетанием в Интернете. У меня возникают проблемы при попытке получить данные из моей базы данных в Firebase с потоками. Я всегда получаю это, когда пытаюсь напечатать поток:

syncSnapshot<List<Arbitro>>(ConnectionState.waiting, null, null) 

Я пытался запустить другой метод для связи с firebase и обновить некоторые данные, но я получил эту ошибку:

MissingPluginException(No implementation found for method DocumentReference#setData on channel plugins.flutter.io/cloud_firestore)

Я пытался:

  • очистить сборку
  • перестроить для веб
  • плагин обновления
  • запустить в режиме отладки
  • запустить в режиме релиза

Нет ошибок компиляции. Я действительно не знаю, как исправить и в чем моя ошибка. Вы можете мне помочь?

Ниже я приведу самую важную часть кода и трепетного доктора. Если вам нужно что-то еще, просто скажите мне! Спасибо за помощь

import 'package:designazioniWebApp/models/arbitro.dart';
import 'package:designazioniWebApp/services/databaseServices.dart';
import 'package:designazioniWebApp/widgets/refList/refTile.dart';
import 'package:flutter/material.dart';

class RefList extends StatefulWidget {
  @override
  _RefListState createState() => _RefListState();
}

class _RefListState extends State<RefList> {
  @override
  Widget build(BuildContext context) {

    List<Arbitro> refs;

    //Stream Builder 

    return StreamBuilder<List<Arbitro>>(
        stream: DatabaseService().getRefsData,
        builder: (context, snapshot) {
          print(snapshot.toString());
          if (snapshot.hasData) {
            refs = snapshot.data;
            // Sort Meetings
            refs.sort((a, b) {
              return a.cognome.toLowerCase().compareTo(b.cognome.toLowerCase());
            });
            // End Sorting

            return Container(
              width: 600,
              child: ListView.builder(
                itemCount: refs.length,
                itemBuilder: (context, index) {
                  return RefTile(arbitro: refs[index]);
                },
              ),
            );
          } else {
            return CircularProgressIndicator();
          }
        });
  }
}

PUBSPE C .yaml

name: designazioniWebApp
description: A new Flutter project.

# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

  # FireBase Dependencies
  firebase_core: ^0.4.3+2
  firebase_auth: ^0.15.3+1
  cloud_firestore: ^0.13.0+1
  firebase_messaging: ^6.0.9
  firebase_storage: ^3.1.1

  provider: ^4.0.1
  responsive_builder: ^0.1.4
  get_it: ^3.1.0

  flutter_spinkit: ^4.1.1+1
  url_launcher: ^5.4.1
  file_picker: ^1.4.3+2

dev_dependencies:
  flutter_test:
    sdk: flutter


# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  # To add assets to your application, add an assets section, like this:
  assets:
   - assets/LogoGap.png
   - assets/LogoGapColorato.jpg
   - assets/LogoGapGrande.png
  #  - images/a_dot_ham.jpeg

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  fonts:
    - family: Roboto
      fonts:
        - asset: assets/fonts/Roboto-Regular.ttf
        - asset: assets/fonts/Roboto-Bold.ttf
          weight: 700
        - asset: assets/fonts/Roboto-Thin.ttf
          weight: 300
    - family: Open Sans
      fonts:
        - asset: assets/fonts/OpenSans-Regular.ttf
        - asset: assets/fonts/OpenSans-ExtraBold.ttf
          weight: 800
  #   - family: Trajan Pro
  #     fonts:
  #       - asset: fonts/TrajanPro.ttf
  #       - asset: fonts/TrajanPro_Bold.ttf
  #         weight: 700
  #
  # For details regarding fonts from package dependencies,
  # see https://flutter.dev/custom-fonts/#from-packages

FLUTTER DOCTOR

Downloading android-arm-profile/windows-x64 tools...                0,7s
Downloading android-arm-release/windows-x64 tools...                0,6s
Downloading android-arm64-profile/windows-x64 tools...              0,8s
Downloading android-arm64-release/windows-x64 tools...              0,7s
Downloading android-x64-profile/windows-x64 tools...                1,0s
Downloading android-x64-release/windows-x64 tools...                0,7s
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel beta, v1.13.6, on Microsoft Windows [Versione 10.0.18362.592], locale it-IT)

[!] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses
[√] Chrome - develop for the web
[√] Android Studio (version 3.4)
[√] VS Code (version 1.41.1)
[√] Connected device (2 available)

! Doctor found issues in 1 category.
...