Class 'String' has no instance getter 'path'.

2,548 views
Skip to first unread message

Charisa Emmanuel

unread,
Sep 1, 2020, 3:45:04 PM9/1/20
to Flutter Development (flutter-dev)
Hi there,
I need help, just got this error:
Screenshot (331).png
and I don't understand what it's saying
here is my code for `authstate`:
```
Future<String> signUp(\\ some code){
\\code above
await result.user.updateProfile(updateInfo);
      await FireStoreClass.addUser(
          image: updateInfo.photoUrl, displayName: updateInfo.displayName);
\\code below
}
```
please help

Fabricio Valadares

unread,
Sep 1, 2020, 4:14:08 PM9/1/20
to Charisa Emmanuel, Flutter Development (flutter-dev)
Hi!

The error message said the String does not have an instance of get 'path'. What data type are you expecting in your method?

Check the firestore docs to see which kind of data this method returns.

Regards ;)
---
Fabrício G. Valadares
Lattes: http://lattes.cnpq.br/1002632563427298
Mobile: +55 31 9 9357-6193
mail: fabricio....@gmail.com

Os homens conseguiriam muito mais coisas se julgassem menos coisas impossíveis.

Embora ninguém possa voltar atrás e fazer um novo começo, qualquer um pode começar agora e fazer um novo fim. Francisco Cândido Xavier


The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system.



--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/b22e9294-3590-4718-b880-8ebd57a44502n%40googlegroups.com.

Suzuki Tomohiro

unread,
Sep 1, 2020, 4:30:55 PM9/1/20
to Charisa Emmanuel, Flutter Development (flutter-dev)
Charisa,

Would you share code around firestoreDB.dart:78?

--

Charisa Emmanuel

unread,
Sep 2, 2020, 10:03:20 AM9/2/20
to Suzuki Tomohiro, Flutter Development (flutter-dev)
Ok sure, the is the code attached
On Sep 1, 2020, 8:30 PM +0000, Suzuki Tomohiro <suz...@gmail.com>, wrote:
Charisa,

Would you share code around firestoreDB.dart:78?

On Tue, Sep 1, 2020 at 3:45 PM Charisa Emmanuel <charisa4c...@gmail.com> wrote:
Hi there,
I need help, just got this error:
firestoreDB.txt

Charisa Emmanuel

unread,
Sep 2, 2020, 10:04:52 AM9/2/20
to Fabricio Valadares, Flutter Development (flutter-dev)
I'm trying the get an image url that will be downloaded from firebase storage which is gotten when user updates profile pic
On Sep 1, 2020, 8:14 PM +0000, Fabricio Valadares <fabricio....@gmail.com>, wrote:
Hi!

The error message said the String does not have an instance of get 'path'. What data type are you expecting in your method?

Check the firestore docs to see which kind of data this method returns.

Regards ;)
---
Fabrício G. Valadares
Lattes: http://lattes.cnpq.br/1002632563427298
Mobile: +55 31 9 9357-6193
mail: fabricio....@gmail.com

Os homens conseguiriam muito mais coisas se julgassem menos coisas impossíveis.

Embora ninguém possa voltar atrás e fazer um novo começo, qualquer um pode começar agora e fazer um novo fim. Francisco Cândido Xavier


The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system.



On Tue, 1 Sep 2020 at 16:45, Charisa Emmanuel <charisa4c...@gmail.com> wrote:
Hi there,
I need help, just got this error:

Fabricio Valadares

unread,
Sep 2, 2020, 10:45:11 AM9/2/20
to Charisa Emmanuel, Flutter Development (flutter-dev)
Hi Charisa, :)

What is the type of data that you are passing as parameter to the field image in the method below. In blue is the line 78, which is marked as an error in your log. I highlighted in yellow the image parameter, that expects a member called path. I thought that image should be some object, not a string ;)

I hope that this helps you :)

  static Future<void> updateLiveStore({displayName, image, livepic}) async {
    StorageReference storageReference = FirebaseStorage.instance
        .ref()
        .child('$livepic/${Path.basename(image.path)}');

    StorageUploadTask uploadTask = storageReference.putFile(image);
    await uploadTask.onComplete;
    await storageReference.getDownloadURL().then((fileURL) async {
      final prefs = await SharedPreferences.getInstance();
      await prefs.setString('displayName', displayName);
      await prefs.setString('image', fileURL);
      await _db.collection(userCollection).document(displayName).updateData({
        'displayName': displayName,
        'image': fileURL,
      });
      return true;
    });
  }
---
Fabrício G. Valadares
Lattes: http://lattes.cnpq.br/1002632563427298
Mobile: +55 31 9 9357-6193
mail: fabricio....@gmail.com

Os homens conseguiriam muito mais coisas se julgassem menos coisas impossíveis.

Embora ninguém possa voltar atrás e fazer um novo começo, qualquer um pode começar agora e fazer um novo fim. Francisco Cândido Xavier


The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system.


Reply all
Reply to author
Forward
0 new messages