Flutter Heroes
26.1K subscribers
272 photos
2 videos
31.1K links
Download Telegram
New post on /r/flutterdev subreddit:

<b>Abstract API class</b>
What are the best practices to refactor this class?&#8203;<pre>class ClinicRepository { final FirebaseFirestore _firebaseFirestore; final CategoryRepository _categoryRepository; final Geoflutterfire _geoflutterfire; GeoFirePoint center; double radius = 5.0; bool hasMoreTopRated = true; bool hasMoreCategory = true; bool hasMoreReviews = true; CollectionReference _clinicCollection; CollectionReference _doctorCollection; CollectionReference _reviewsCollection; DocumentSnapshot _lastTopRatedDocument; DocumentSnapshot _lastCategoryDocument; DocumentSnapshot _lastReviewDocument; ClinicRepository({ CenterPoint centerPoint, FirebaseFirestore firebaseFirestore, Geoflutterfire geoflutterfire, LocationServices locationServices, CategoryRepository categoryRepository, }) : _firebaseFirestore = firebaseFirestore ?? FirebaseFirestore.instance, _geoflutterfire = geoflutterfire ?? Geoflutterfire(), _categoryRepository = categoryRepository ?? CategoryRepository() { _clinicCollection = _firebaseFirestore.collection("clinics"); _doctorCollection = _firebaseFirestore.collection("doctors"); _reviewsCollection = _firebaseFirestore.collection("reviews"); center = GeoFirePoint(centerPoint.latitude, centerPoint.longitude); } Future<List<Clinic>> getNearbyClinics({int limit = 10}) async { List<Clinic> clinics = []; List<DistanceDocSnapshot> snapshot = await _geoflutterfire .collection(collectionRef: _clinicCollection) .within(center: center, radius: radius, field: 'position', limit: limit) .first; for (var clinic in snapshot) { final categoryId = clinic.documentSnapshot.data()['category']; final category = await _categoryRepository.getCategoryById(categoryId); clinics.add(Clinic.fromJson(clinic.documentSnapshot.id, clinic.distance, clinic.documentSnapshot.data()) ..category = category.name); } return clinics; } Future<List<Clinic>> getTopRatedClinics(int limit, {bool isRefresh = false}) async { if (isRefresh) { _lastTopRatedDocument = null; hasMoreTopRated = true; } if (!hasMoreTopRated) return []; QuerySnapshot snapshot; if (_lastTopRatedDocument != null) { snapshot = await _clinicCollection .orderBy('rate', descending: true) .startAtDocument(_lastTopRatedDocument) .limit(limit) .get(); } else { snapshot = await _clinicCollection .orderBy('rate', descending: true) .limit(limit) .get(); } if (snapshot.docs.length < limit) { hasMoreTopRated = false; } _lastTopRatedDocument = snapshot.docs.last; return snapshot.docs.map((clinic) { final clinicData = Clinic.fromJson(clinic.id, getDistance(clinic.data()['position']['geopoint']), clinic.data()); bool isClinicOpen = isOpen(clinicData.openTime, clinicData.closeTime); return clinicData..isOpen = isClinicOpen; }).toList(); } Future<List<Clinic>> getClinicsByCategory(String categoryID, int limit, {bool isRefresh = false}) async { assert(categoryID != null); if (isRefresh) { _lastCategoryDocument = null; hasMoreCategory = true; } if (!hasMoreCategory) return []; QuerySnapshot snapshot; if (_lastCategoryDocument != null) { snapshot = await _clinicCollection .where('category', isEqualTo: categoryID) .startAfterDocument(_lastCategoryDocument) .limit(limit) .get(); } else { snapshot = await _clinicCollection .where('category', isEqualTo: categoryID) .limit(limit) .get(); } if (snapshot.docs.length < limit) { hasMoreCategory = false; } _lastCategoryDocument = snapshot.docs.last; return snapshot.docs.map((clinic) { final clinicData = Clinic.fromJson(clinic.id, getDistance(clinic.data()['position']['geopoint']), clinic.data()); bool isClinicOpen = isOpen(clinicData.openTime, clinicData.closeTime); return clinicData..isOpen = isClinicOpen; }).toList(); } Future<List<Review>> getClinicReviews(String clinicId, {int limit = 3, isRefresh = false}) async { assert(clinicId != null); if (isRefresh) { _lastReviewDocument = null; hasMoreReviews = true; } if (!hasMoreReviews) return []; QuerySnapshot snapshot; if (_lastReviewDocument != null) { snapshot = await _reviewsCollection…
New post on Flutter Dev Google group:

My pedometer not working on some devices
Hello, I'm trying to making a step counter app with pedometer package, but it doesn't work properly, Some devices counting the steps, but some devices don't. How can I fix that, need your help? If anyone can give me an idea or help, I will be appreciated. Thank you. Regards

February 24, 2021 at 03:04PM by Halil İbrahim Yücel
https://ift.tt/3qS8MRR
New post on Flutter Dev Google group:


how to show json data in list in flutter that will send by native side?? -- We greatly appreciate your business. Can you take 1 minute to answer to leave a review on Salesforce AppExchange < https://appexchange.salesforce.com/appxConsultingListingDetail?listingId=a0N3A00000E2KKpUAN> about

February 24, 2021 at 03:06PM by Rashid Ali
https://ift.tt/3bAqEKH
New post on /r/flutterdev subreddit:

Matching tiles using GridView.count
I been thinking about how to implement such a thing and I just can't figure it out. How would you go about implementing a Grid view in which it's items can be selected but it two at a time. If you have a two different lists that have a one to one relationship, how would you check if the selected item is a pair in the other list?I'm thinking it has something to do with checking it's index but I'm a little confused in the algorithm itself. I started programming about 9 months ago and moved to flutter about 4 months ago so I'm not too experienced with this. Will a map be needed?Thanks for any help.

February 24, 2021 at 03:59PM by HenryNanaAdu
https://ift.tt/3pQfyGy
New post on /r/flutterdev subreddit:

Open Source Flutter Apps
Hi!,For a development course at my university I have to make a report for an open source application made with Flutter. This has to be an app with more than 50k downloads and I am having trouble finding one with that many downloads. Do you know about any application that meets this criteria?

February 24, 2021 at 05:14PM by JuanWTF11
https://ift.tt/37LA19n
New post on /r/flutterdev subreddit:

The `rpc_gen` is a builder and generator of RPC (Remote Procedure Call) stub files.
The main goals and purpose of this project:Fast (in minutes) creation of RPC services simultaneously for server and clientFast (in seconds) creation of RPC procedures simultaneously on the server and clientMaximum flexibility in the choice of how to send and handle procedure callsEasily maintenance of consistency of source code for procedures on both layersConventions (of limitations, if you like to call it that):The Request and Response classes must JSON modelsThe JSON models must contain a constructor like formJson(Map json)The JSON models must contain an instance method like Map<String, dynamic> toJson()The RPC methods must be declared like Future<Response> Function(Request)The RPC service metadata class (interface) should contain nothing but methodshttps://pub.dev/packages/rpc_gen
https://github.com/mezoni/rpc_gen

February 24, 2021 at 04:22PM by andrew_mezoni
https://ift.tt/3aO8e9X
New post on /r/flutterdev subreddit:

It's been some time, but Beamer v0.7.0 has finally been published with cool new features and examples
In order of my personal liking, I would point out these new features:logo!providing something to the entire location, i.e. to all of its pagesimplicit beamBack on popfull beamHistoryAlso, examples got some new friends: location_builder and animated_rail integration (using the animated_rail package). Feel free to leave your example suggestion here.All contributions are welcome! Pick an issue to work on, make a new one with your suggestion or submit a PR with complete implementation of your idea.pub.dev: https://pub.dev/packages/beamer
GitHub: https://github.com/slovnicki/beamer

February 24, 2021 at 05:35PM by llsII
https://ift.tt/2MlGBf7
New post on /r/flutterdev subreddit:

Reverse engineering Flutter apps (Part 2)
https://ift.tt/2NrCiQ9

February 24, 2021 at 05:24PM by InfiniPixel
https://ift.tt/2ZSN981
New tweet from FlutterDev:

🔴 Anddd we're live! 🔴

Attend the #30DaysOfFlutter Humpday Q&A livestream now and find out how to share your #Flutter app with the community! Don't miss out on the live coding session featuring @jfkdev and a Q&A from @csells.

Tune in here 👉 https://t.co/KxerUKm0nA pic.twitter.com/GqscP0Vsrx— Flutter (@FlutterDev) February 24, 2021

February 24, 2021 at 06:00PM
http://twitter.com/FlutterDev/status/1364621114991931392
New post on Flutter Dev Google group:

Contract Job Opportunity // Hot Requirements // Immediate interviews
Hello Associates, Kindly send me resume at *Austi...@mirthconsulting.net
New post on Flutter Dev Google group:

Map navigation
Hello .... please help me to show live route navigation(according to users movement) in a flutter map app.

February 24, 2021 at 07:58PM by sona
https://ift.tt/3stQqHr
New post on /r/flutterdev subreddit:

Integration Tests on Windows Love Terminal
Just noting that if you are on MS Windows you still have to execute the drive part via terminal with this:​flutter drive --driver=test_driver/integration_test.dart --target=integration_test/widget_screen_test.dart --host-vmservice-port 8888 > machine.logAnd you get a nice machine.log file afterwards that states in it that the tests passed.Your app run config should have this--host-vmservice-port 8888as additional args​AND! the IntegrationTestWidgetsFlutterBinding.ensureInitialized();line has to be the very first line in main in your widget_screen_test in the integration_test folder as it cannot be in any setup blocksHopefully, Google improves

February 24, 2021 at 07:17PM by fredgrott
https://ift.tt/3kkvq2U
New tweet from FlutterDev:

♨️Hot and ready, 3 new effects recipes for your Flutter buffet!

On the menu:
Download button
Typing indicator
Drag UI element

Keep an eye out, there are 6 more recipes coming soon!

Start here &rarr; https://t.co/WxYo3kL4wB pic.twitter.com/VpLoQ4eKl4— Flutter (@FlutterDev) February 24, 2021

February 24, 2021 at 08:00PM
http://twitter.com/FlutterDev/status/1364651513918840832