【问题标题】:The getter 'user' was called on null在 null 上调用了 getter 'user'
【发布时间】:2021-10-22 09:05:39
【问题描述】:

我正在尝试向 Firebase 提交表单,但收到错误 Getter 'user' was called on null。我不知道如何解决这个问题。一切看起来都很好,不知道为什么会出现此错误。我试着做一个

empty String like this  String user = '';

但它仍然给我错误。

这是我将数据上传到 Firebase 的学员

import 'dart:io';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_geocoder/geocoder.dart';
import 'package:image_picker/image_picker.dart';
import 'package:location/location.dart';

class AuthProvider extends ChangeNotifier {
  FirebaseAuth _authData = FirebaseAuth.instance;

  File image;
  bool isPicAvail = false;
  String pickerError = '';
  double storeLatitude;
  double storeLongitude;
  String storeAddress;
  String placeName;
  String error = '';
  bool loading = false;
  String email;

  
  Future<void>saveVendorData({
    String url, shopName, number, aboutShop, cnicNumber, ntnNumber}){
    User user = FirebaseAuth.instance.currentUser;
    DocumentReference _vendors = FirebaseFirestore.instance.collection('vendors').doc(user.uid);
    _vendors.set({
      'uid': user.uid,
      'email': this.email,
      'shopName': shopName,
      'number': number,
      'aboutShop': aboutShop,
      'cnicNumber': cnicNumber,
      'ntnNumber': ntnNumber,
      'address': '${this.placeName}: ${this.storeAddress}',
      'location': GeoPoint(this.storeLatitude, this.storeLongitude),
      'shopOpen': true,
      'rating': 0.00,
      'totalRating': 0
    });
    return null;
  }


}

错误出现在这一行的表格中。 credential.user?.uid!=null

TextButton(
                  onPressed: () {
                    if(_authData.isPicAvail == true) {
                      if (_formKey.currentState.validate()) {
                        setState(() {
                          loading = true;
                        });
                        _authData.registerVendor(email,password).then((credential){
                          if(credential.user?.uid!=null){
                            uploadFile(_authData.image.path).then((url){
                              if(url!=null){
                                _authData.saveVendorData(
                                  url: url,
                                  number: number,
                                  shopName: shopName,
                                  aboutShop: _aboutShopController.text,
                                  cnicNumber: _cnicNumberController.text,
                                  ntnNumber: _ntnNumberController.text,
                                ).then((value) {
                                  setState(() {
                                  //  _formKey.currentState.reset();
                                    loading = false;
                                  });
                                  Navigator.pushReplacementNamed(context, HomeScreen.id);
                                });
                              }else{
                                scaffoldMessage('Failed to upload Shop Pic');
                              }
                            });
                          }else{
                            scaffoldMessage(_authData.error);
                          }
                        });
                      }
                    }else{
                      scaffoldMessage('Please add Shop Pic');
                    }
                    },
                  child: Text('Register'),
                  style: TextButton.styleFrom(
                    primary: Colors.black,
                    backgroundColor: Colors.greenAccent,
                    onSurface: Colors.grey,
                  ),
                ),

这是错误

Launching lib\main.dart on Android SDK built for x86 in debug mode...
Running Gradle task 'assembleDebug'...
Parameter format not correct -
√  Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk...
D/FlutterLocationService( 5018): Creating service.
D/FlutterLocationService( 5018): Binding to location service.
D/EGL_emulation( 5018): eglMakeCurrent: 0xa6285e00: ver 2 0 (tinfo 0x8c340180)
Debug service listening on ws://127.0.0.1:51256/Syc26foQ1_0=/ws
Syncing files to device Android SDK built for x86...
D/EGL_emulation( 5018): eglMakeCurrent: 0xa38f76e0: ver 2 0 (tinfo 0x8d4a9280)
D/EGL_emulation( 5018): eglMakeCurrent: 0xa6285e00: ver 2 0 (tinfo 0x8c340180)
D/EGL_emulation( 5018): eglMakeCurrent: 0xa38f76e0: ver 2 0 (tinfo 0x8d4a9280)
D/EGL_emulation( 5018): eglMakeCurrent: 0xa6285e00: ver 2 0 (tinfo 0x8c340180)
D/EGL_emulation( 5018): eglMakeCurrent: 0xa38f76e0: ver 2 0 (tinfo 0x8d4a9280)
I/zygote  ( 5018): Do partial code cache collection, code=60KB, data=53KB
I/zygote  ( 5018): After code cache collection, code=60KB, data=53KB
I/zygote  ( 5018): Increasing code cache capacity to 256KB
I/TextInputPlugin( 5018): Composing region changed by the framework. Restarting the input method.
W/ListenableEditingState( 5018): a listener was added to EditingState while a batch edit was in progress
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
I/TextInputPlugin( 5018): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
I/zygote  ( 5018): Do full code cache collection, code=122KB, data=89KB
I/zygote  ( 5018): After code cache collection, code=94KB, data=53KB
I/TextInputPlugin( 5018): Composing region changed by the framework. Restarting the input method.
W/ListenableEditingState( 5018): a listener was added to EditingState while a batch edit was in progress
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
I/zygote  ( 5018): Do partial code cache collection, code=121KB, data=82KB
I/zygote  ( 5018): After code cache collection, code=121KB, data=82KB
I/zygote  ( 5018): Increasing code cache capacity to 512KB
I/TextInputPlugin( 5018): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
I/TextInputPlugin( 5018): Composing region changed by the framework. Restarting the input method.
W/ListenableEditingState( 5018): a listener was added to EditingState while a batch edit was in progress
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
I/TextInputPlugin( 5018): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
I/TextInputPlugin( 5018): Composing region changed by the framework. Restarting the input method.
W/ListenableEditingState( 5018): a listener was added to EditingState while a batch edit was in progress
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
I/TextInputPlugin( 5018): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
I/TextInputPlugin( 5018): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 5018): clearMetaKeyStates on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
I/TextInputPlugin( 5018): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
I/TextInputPlugin( 5018): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
I/TextInputPlugin( 5018): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
I/TextInputPlugin( 5018): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
I/TextInputPlugin( 5018): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
I/TextInputPlugin( 5018): Composing region changed by the framework. Restarting the input method.
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextBeforeCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getTextAfterCursor on inactive InputConnection
W/IInputConnectionWrapper( 5018): getSelectedText on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): beginBatchEdit on inactive InputConnection
W/IInputConnectionWrapper( 5018): endBatchEdit on inactive InputConnection
W/System  ( 5018): Ignoring header X-Firebase-Locale because its value was null.
E/flutter ( 5018): [ERROR:flutter/lib/ui/ui_dart_state.cc(199)] Unhandled Exception: NoSuchMethodError: The getter 'user' was called on null.
E/flutter ( 5018): Receiver: null
E/flutter ( 5018): Tried calling: user
E/flutter ( 5018): #0      Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
E/flutter ( 5018): #1      _RegisterationFormState.build.<anonymous closure>.<anonymous closure> (package:vendorapp/widgets/registertion_form.dart:337:41)
E/flutter ( 5018): #2      _rootRunUnary (dart:async/zone.dart:1362:47)
E/flutter ( 5018): #3      _CustomZone.runUnary (dart:async/zone.dart:1265:19)
E/flutter ( 5018): <asynchronous suspension>
E/flutter ( 5018): 
I/zygote  ( 5018): Background concurrent copying GC freed 35177(1436KB) AllocSpace objects, 0(0B) LOS objects, 57% free, 1140KB/2MB, paused 5.919ms total 30.413ms
D/EGL_emulation( 5018): eglMakeCurrent: 0xa6285e00: ver 2 0 (tinfo 0x8c340180)

【问题讨论】:

    标签: firebase flutter dart firebase-authentication flutter-form-builder


    【解决方案1】:

    我自己解决。

    1. 卸载应用程序。
    2. 运行“flutter clean”
    3. 运行“flutter pub get”

    再次运行应用程序即可解决问题。

    【讨论】:

      【解决方案2】:

      credential.user?.uid!=null 用户不能为空。

      class AuthProvider extends ChangeNotifier {
        FirebaseAuth _authData = FirebaseAuth.instance;
      
        User user = User(); // added
      

      user = FirebaseAuth.instance.currentUser;

      你可以试试这个方法吗?

      【讨论】:

      • 感谢您的回复,但它给出了这个错误The class User doesn't have a default constructor. (Documentation) Try using one of the named constructors defined in 'User'
      • 如果在第一个文件的最后看到,我已经在saveVendorData 中添加了这个User user = FirebaseAuth.instance.currentUser;
      猜你喜欢
      • 2021-12-21
      • 2020-01-10
      • 2020-10-24
      • 2021-04-13
      • 2020-05-20
      • 2019-01-09
      • 2021-07-21
      • 2020-11-16
      • 2020-07-14
      相关资源
      最近更新 更多