vedartm / paginate_firestore

A flutter package to simplify pagination with firestore data 🗃
https://pub.dev/packages/paginate_firestore
MIT License
113 stars 136 forks source link

documentSnapshot.data() #125

Closed RoyalCoder88 closed 2 years ago

RoyalCoder88 commented 2 years ago

Hi friends,

**Before I used:

paginate_firestore: ^1.0.2, I have implemented something like that:**

final post = documentSnapshot.data() as Map?; if ((index + 1) % ad_frecv == 0) {

=> no I migrated to paginate_firestore: ^1.0.3, the same code now I get this error for .data() : The method 'data' isn't defined for the type 'int'. Try correcting the name to the name of an existing method, or defining a method named 'data'.dart[undefined_method](https://dart.dev/diagnostics/undefined_method) error_1

and for the + :

The operator '+' isn't defined for the type 'BuildContext'. Try defining the operator '+'.dartundefined_operator No quick fixes available error_2

P.S I'm using: Flutter version: Flutter 2.10.1 • channel stable • https://github.com/flutter/flutter.git Framework • revision db747aa133 (4 weeks ago) • 2022-02-09 13:57:35 -0600 Engine • revision ab46186b24 Tools • Dart 2.16.1 • DevTools 2.9.2

paginate_firestore: ^1.0.3 firebase_core: ^1.13.1 firebase_messaging: ^11.2.10 cloud_firestore: ^3.1.10
firebase_storage: ^10.2.9 firebase_auth: ^3.3.10 google_sign_in: ^5.0.4

Please help me asap!

2 P.S:

I get this if I'm using the provider version: ^6.0.2 else if I'm using the version: ^5.0.0 it's working, any idea how to fix this issue?

UPDATED CLOUD_FIRESTORE TO: cloud_firestore: ^3.1.10

FAILED BUILD: `: Error: No named parameter with the name 'emptyDisplay'. lib/pages/new_timeline.dart:101 emptyDisplay: Padding( ^^^^^^^^^^^^ : Context: Found this candidate, but the arguments don't match. ../…/lib/paginate_firestore.dart:19

const PaginateFirestore({ ^^^^^^^^^^^^^^^^^ : Error: The method 'data' isn't defined for the class 'int'. lib/pages/users.dart:63 Try correcting the name to the name of an existing method, or defining a method named 'data'. final userdoc = documentSnapshot.data() as Map?; ^^^^ : Error: The method 'data' isn't defined for the class 'int'. lib/pages/suggested_users.dart:61 Try correcting the name to the name of an existing method, or defining a method named 'data'. final userdoc = documentSnapshot.data() as Map?; ^^^^ : Error: No named parameter with the name 'emptyDisplay'. lib/pages/all_videos.dart:59 emptyDisplay: Padding( ^^^^^^^^^^^^ : Context: Found this candidate, but the arguments don't match. ../…/lib/paginate_firestore.dart:19 const PaginateFirestore({ `

Thanks in advance!

RoyalCoder88 commented 2 years ago

FIXED BY: itemBuilder: (context, documentSnapshot, index) { final post = documentSnapshot[0].data() as Map?;

      If you guys have problems, let me know!