/r/FlutterDev

Photograph via //r/FlutterDev

A community for the publishing of news and discussion about Flutter.

/r/FlutterDev

142,120 Subscribers

6

Map - move camera to an area, not a specific location

I want to implement something similar to google map. Let's say I'm in Hanoi, Vietnam using Google Map, if I search for a district in Hanoi, GG Map will move to that district area and not some specific address.

How to do that with Flutter Map ? Is there anything related to bounding box ?

0 Comments
2024/11/23
03:32 UTC

0

Can I use Flutter Global Configuration at will?

Hi!

Im using Global config instead of database for several cases (since i need a lot of non dynamic pair of values to work with - values that will never change no matter what).

I already have 2 jsons of 300 lines each and im planning to create another one with 3k lines.
Is that ok in terms of perfomance? I dont have a clue.

Thats the best solution for me im terms of project organization and to limit online transactions.
Also easier to develop. But im not sure it theres any negative consequence.

Does someone working with a large project using something like this can tell me if thats ok?
Thank you!!

2 Comments
2024/11/22
20:45 UTC

0

Can Google and Apple handle Paid Apps logic?

I have made an app and want to charge a fee up front of $5.

What do I have to do to make this happen? I was hoping that by not doing in-app purchases, or subscriptions, etc. that it would be much easier to implement, and that Google and Apple would handle the heavy lifting...

Is this right?

12 Comments
2024/11/22
18:53 UTC

4

Getting data from Google Health Connect/Apple Health in the background into Firebase

Hey there folks, we have built an app on Flutter and launched it too to both iOS App and Android Play stores respectively. It is a fitness app and while we have been able to crack the basics of tracking activity and pulling/syncing data from Google Health Connect or Apple Health, we have NOT been able to achieve this when our app is NOT active and is backgrounded.
This plugin Workmanager, does successfully invoke and seek data from the respective health kit, however it is not getting enough time to pull enough information from the respective health kits and hence seems to be retrieving 0 information. I think we've tried every trick in the book possible so far and exhausted every ChatGPT suggestion too.
Has anyone solved this with their flutter app so far? Thanks in advance!

Regards,

Sidharth

3 Comments
2024/11/22
17:28 UTC

16

Claude vs Gemini vs GPT

Which have you found to be best in helping with your code? Most accurate and most efficient?

Finally, which do you think is best to use to turn Figma design images to code?

27 Comments
2024/11/22
16:37 UTC

9

Why can't the compiler handle const widgets?

I have autofix/format on save enabled so I barely have to think about it unless the autofix pre-emptively makes a widget const and I have to undo it which is only mildly annoying but I guess I just don't understand why this is a thing in the first place?

Maybe I'm overly sensitive to this because I'm coming back to Flutter after a long break but I dunno, it just seems to add unnecessary fluff/boilerplate and make the code more bloated / less readable.

I'm never making decisions whether a widget should be const or not. There's always a correct - or incorrect - answer. Just seems like an unnecessary flow interruptor that could easily be delegated to the compiler. Am I missing something?

21 Comments
2024/11/22
15:32 UTC

0

Controlling flutter fps

tl;dr; I need to control how many rebuilds per second are done, i.e. set the fps

Hello everyone,
I'm currently developing an app that needs to flicker simple widgets at a certain frequency. To get, for example, 5 Hz frequency I would need 10 widget rebuilds (one event would be 2 rebuilds for showing and hiding the object). I need up to 60 Hz á 120fps which is barely in possible range for flutter.

My current, first test is this:

import 'dart:async';

import 'package:flutter/material.dart';

class HomeScreen extends StatefulWidget {
  const HomeScreen({super.key});

  u/override
  State<HomeScreen> createState() => _HomeScreenState();
}

class _HomeScreenState extends State<HomeScreen> {
  static const hz = 40.0;

  bool _on = false;
  late Timer _timer;

  @override
  void initState() {
    super.initState();

    _timer = Timer.periodic(
      Duration(
        milliseconds: (1000 / (hz * 2)).round(),
      ),
      (timer) {
        setState(() {
          _on = !_on;
        });
      },
    );
  }

  @override
  void dispose() {
    _timer.cancel();

    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Column(
        children: [
          Container(
            height: 200.0,
            width: 200.0,
            color: _on ? Colors.white : Colors.red,
          ),
        ],
      ),
    );
  }
}

However, there are hiccups when running the app since rebuilds sometimes take longer. Every two or three seconds, there are janks shown in the profile that take ~40ms which leads to incorrect Hz.

I have looked at flame since a flutter game engine might be better at providing fixed fps, however using a whole game engine just for better fps seems overkill. Is there a way to manipulate the rebuild loop of flutter to set fps?

2 Comments
2024/11/22
15:31 UTC

0

Why React-Native has a better portfolio than Flutter?

I'm deciding between Flutter or RN for my app. I've developed a Flutter app in the past so I know my way around. For a new app, it got me thinking, why are all the "serious apps" developed in RN?

24 Comments
2024/11/22
15:02 UTC

0

Plug for notification

Hi everyone I want asked about some plugins for notifications Is good and not hard have good support Any suggestions

6 Comments
2024/11/22
14:49 UTC

3

Database

I am used to working with fixed databases. And now i am using flutter, firebase. How and where should i add additional info about the user like profile image etc ( i used the firebase auth for login) ?

12 Comments
2024/11/22
13:33 UTC

0

Getting push notifications on iPhone 16 Simulator

Hello!
I’m new to the Apple developer ecosystem. I have an app where we’ve added a push notification feature. Previously, I was using iPhone 14 and 15 simulators for development, and I only had a production certificate. This meant that whenever I needed to test push notifications, I had to create a build.

However, today I randomly tried debugging my app on the iPhone 16 simulator, and surprisingly, I was able to receive all types of notifications (foreground, background, and terminated). But I noticed two issues:

  1. I couldn’t see the app badge.
  2. Print statements for the background state didn’t appear in the console.

I also have another MacBook running macOS Ventura. Can I install the latest version of Xcode on it to download the iPhone 16 simulator and test push notifications there?

Additionally, is there a way to get print statements for the background state in the console and show the app badge count in the simulator?

Thank you!

4 Comments
2024/11/22
05:36 UTC

8

Flutter on Ubuntu core?

I want to use flutter to develop a fairly complex app for restaurant point of sale and other things like kitchen display. Do you guys think flutter with Ubuntu core frame is a good option for this? Is there a way to know if certain flutter packages will not work on Linux vs Android? I am planning to use packages like bloc, http client, and websocket channels package.

13 Comments
2024/11/22
01:51 UTC

79

🚀 Hive CE 2.8.0 Released: Streamlined Code Generation with GenerateAdapters & New Migration Tool!

Hello Flutter community! I am thrilled to announce the release of the most significant update to Hive Community Edition yet. Version 2.8.0 introduces support for the new GenerateAdapters annotation, which significantly enhances the code generation experience. With this annotation, you can simply specify the classes you want to generate adapters for, eliminating the need for manual annotation of every type and field, and keeping track of their IDs. This new annotation also enables the generation of adapters for classes located outside the current package. For instance, it allows you to create adapters for model classes generated using the openapi-generator.

Additionally, I have developed a migration tool to facilitate the transition from the old annotations. This tool ensures that your model classes are free from common issues that could lead to data integrity problems, and then generates the required files.

For more information about the update, please refer to the documentation here: https://pub.dev/packages/hive_ce#store-objects

15 Comments
2024/11/21
22:50 UTC

2

Help with Media kit save video time position

Hello. I am new to Dart programming language. I tried to create a video player using Media Kit and I want to add saving the time I reached when watching or when I change the quality it returns to the same time I watched In the previous link. I tried a lot but failed. Can you help me please? I tried to add shared_preferences But I didn't know how to add it.

1 Comment
2024/11/21
22:10 UTC

2

Flame vs out of the box tools

I am opening this discussion to get some advice and read your different takes.

I plan on making a card game that will also support online multiplayer + different screens, probably web and mobile.

I see that you can both use Flame or just Flutter widgets to make the game, but there must be certain aspects of making a game that makes the difference and I want to hear from you what's the best option and why.

16 Comments
2024/11/21
17:11 UTC

1

Calculate distance between start point and (undefined) endpoint

Whats the best way to calculate distance between two points without having the endpoint defined at the start for example using car meter where i need to start tracking the distance covered by this car without actually defining where its going to stop but rather stopping the tracking when the user press stop

5 Comments
2024/11/21
16:44 UTC

0

Flutter project backup and branching - how?

Hi!

My app became bigger than i expected and now im afraid of making critical changes.
I think that i made a reasonably non-spaguetti code, but some changes are in main dart or cfg files and i dont have a good way to roll-back to previous stable code. Im afraid of breaking it at some point.

How do you guys do the branching control and roll-back if necessary? Its github the only easy solution?

(ive been doing my backup manually to drive until now... insane, i know)

Thank you!

16 Comments
2024/11/21
12:45 UTC

0

Skill set

Serching for flutter app developer jobs what skillset should i search in naukri

0 Comments
2024/11/21
11:30 UTC

40

Created a Flutter SMS Background Plugin after struggling with outdated ones during a hackathon 📱

Hey Flutter devs! 👋

During a recent hackathon, I was building an emergency alert app that needed to send SMS messages in the background. I found several existing packages, but ran into issues:

- Most weren't updated for recent Flutter versions
- Permission handling was broken on Android 13 & 14
- Background sending was unreliable
- Some had complex implementations for simple tasks

After spending hours trying to make them work, I decided to create a simple, modern solution.

Introducing [flutter_background_messenger](
https://pub.dev/packages/flutter_background_messenger
) - a lightweight plugin that just works!

✨ Features:
- Clean, simple API
- Proper permission handling for Android 13+
- Reliable background SMS sending
- Modern Flutter/Android implementation
- Minimal setup required

🔗 Links:
- Pub.dev: https://pub.dev/packages/flutter_background_messenger
- GitHub: https://github.com/P-yiush07/background-sms

Would love to hear your feedback and suggestions! Feel free to open issues or contribute. Let's make SMS handling in Flutter better together! 🚀

Edit: Thanks for the support! Working on adding more features based on your suggestions.

20 Comments
2024/11/21
11:16 UTC

0

Help, how to identify a device in a local network

Hi,
I created a code that gets all devices IPs in a local network on a specific port. For example gets all the printers IPs. I need the users to be able to assign a custom name to each printer, but if I relate the custom name to the device IP is not good because the assigned IPs in a LAN changes (am I correct?).

So I need to get the MAC address or another persistent unique device identifier, so I can relate that one to the name assigned by the users.
I searched a lot but I couldn't find a way to get the MAC of a device in a LAN, do anyone know a way or a workaround to achieve my goal?

Many thanks in advance!

8 Comments
2024/11/21
09:25 UTC

0

Letter tracing

Any suggestion on how can i achieve letter tracing/alphabet traing for creating a learning app? I know how to make the drawing function using custome paint, but how do i validate or checking if the drawing is the same as the letter in the background

5 Comments
2024/11/21
06:54 UTC

0

Managing localization files/string in flutter app.

How you guy's manager your localization files. I mean when your app support multiple languages (let's say 3 to 5 or more) and have atleast 100keys (which was normally) so how you manage them.

Because manually it's was pretty time consuming task and it' their was some local which you doesn't know then it's become the more headache since we need to translate every string one by one via good translate or gpt.

6 Comments
2024/11/21
06:39 UTC

23

Anyone used shorebird?

Hello, i came across this https://shorebird.dev/ looks quite interesting, it'd be nice to save me from dealing with appstore and playstore so consistently. Has anyone tried this? I've read that they had a bunch of IOS issues from a 10mo old post, how is it today?

39 Comments
2024/11/21
06:24 UTC

Back To Top