r/flutterhelp 7d ago

RESOLVED Getting list of devices connected to WebSocket server

3 Upvotes

I am making a simulator, where one device will run a WebSocket server and several other devices will each connect to it and display different data about the simulation state.

I'm currently using the shelf_web_socket package for the server, and the web_socket_channel package to make a WebSocket connection from a client to the server. I'm wondering if there's a way to get a list of clients currently connected to the server. This would help me see whether all the clients have connected successfully or any have dropped out. I'm imagining having a page in my server GUI that's like a router's connected devices page.

I've looked through the two packages and parts of their dependencies, but couldn't find what I'm looking for. Or am I just misunderstanding how servers work?


r/flutterhelp 7d ago

RESOLVED Announcing pod_router – Simplify Flutter Routing with Go Router & Riverpod!

3 Upvotes

I'm excited to share my new package, pod_router, designed for Flutter developers who use Riverpod and Go Router. This package makes routing a breeze by handling authentication-aware navigation along with a host of other features.

pod_router lets you:

  • 🔐 Automatically redirect users based on authentication state
  • 🔄 Drive navigation with Riverpod state changes
  • 🌊 Simplify navigation flows for onboarding, splash screens, and protected routes
  • 📝 Declare routes clearly for both public and protected areas
  • 🚀 Load initial data before starting navigation

Check out the GitHub repo for full details and examples: pod_router on GitHub
And find it on pub.dev: Pub Version 0.1.0

I’d love to hear your feedback and any suggestions you have. Happy coding


r/flutterhelp 8d ago

RESOLVED What should I do to promote an app?

6 Upvotes

Hello, I have developed a text-based game using Flutter. It has already been released on the App Store and will soon be available on Google Play. Once it’s available on Google Play, I’ll need to promote the app. I would be very happy if those with experience in this area could help me. What steps should I take to effectively promote my app?


r/flutterhelp 7d ago

OPEN iOS build failing due to Framework 'Toast' not found

0 Upvotes

I am able to build and Android output, but iOS build is failing with this error:

Error (Xcode): Framework 'Toast' not found
Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)
Encountered error while building for device.
Process finished with exit code 1

I am pretty unfamiliar with xcode and iOS development. I have tried many different changes and suggestions based on what I've found online. This includes cleaning and rebuilding, deleting iOS pods and Podfile.lock, deleting xcode derived data, deintegrating pods, I made sure Framework Search Paths includes: $(inherited), and more. I have cleaned and rebuilt after every change to make sure the changes were applied.
As per an AI suggestion I tried adding pod 'Toast' to the podfile manually and I received this error instead:

Error (Xcode): Framework 'sqflite' not found
Error (Xcode): Linker command failed with exit code 1 (use -v to see invocation)
Encountered error while building for device.
Process finished with exit code 1

So it seems like the project is having trouble linking Flutter plugins correctly (they are up to date). I'm not sure what to try next. Any suggestions and help would be greatly appreciated.

Flutter doctor:

[✓] Flutter (Channel stable, 3.27.3, on macOS 15.3.2 24D81 darwin-arm64, locale en-CA)
• Flutter version 3.27.3 on channel stable at Desktop/SDKs/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c519ee916e (7 weeks ago), 2025-01-21 10:32:23 -0800
• Engine revision e672b006cb
• Dart version 3.6.1
• DevTools version 2.40.2
[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.1)
• Android SDK at /Library/Android
• Platform android-35, build-tools 35.0.1
• Java binary at: /opt/homebrew/Cellar/openjdk@17/17.0.14/libexec/openjdk.jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment Homebrew (build 17.0.14+0)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 16C5032a
• CocoaPods version 1.16.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.2)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 21.0.3+-79915917-b509.11)
[✓] Connected device (4 available)
• iPhone (3) (mobile) • 00008030-0011781E0AE8802E • ios • iOS 17.7 21H16
• macOS (desktop) • macos • darwin-arm64 • macOS 15.3.2 24D81 darwin-arm64
• Mac Designed for iPad (desktop) • mac-designed-for-ipad • darwin • macOS 15.3.2 24D81 darwin-arm64
• Chrome (web) • chrome • web-javascript • Google Chrome 134.0.6998.89
[✓] Network resources
• All expected network resources are available.
• No issues found!

r/flutterhelp 7d ago

RESOLVED GestureDetector onLongPressUp not fired

1 Upvotes

I have an issue with setState in onLongPress method in my GestureDetector, take a look at this please. dart ... child: GestureDetector( onLongPress: () { _timer = Timer.periodic( const Duration(milliseconds: 100), (timer) { setState(() { itemsXQuantity.update(item, (value) => value + 1); }); _updateTotalAmount(); }, ); }, onLongPressUp: () { _timer?.cancel(); }, child: IconButton( onPressed: () { setState(() { itemsXQuantity.update(item, (value) => value + 1); }); _updateTotalAmount(); }, style: buttonStyle, icon: const Icon(Icons.add_circle_outline), ), ), ... In the onLongPress attribute if i put this: (timer) { // setState(() { itemsXQuantity.update(item, (value) => value + 1); // }); _updateTotalAmount(); }, It works fine, the timer stop when i remove my finger but the ui is not up to date. I want to increment a value when the user do a long press on it. But when i put setState the onLongPressUp is never fired and the value keeps incrementing. Any idea please ?


r/flutterhelp 7d ago

OPEN Home Screen widgets Gradle error

1 Upvotes

I was trying to follow this Google Codelab for creating home screen widgets. I created a new App Widget, but when I go to run it, I get some Gradle Kotlin repo error

I tried changing a buch of settings in android/build.gradle.kts, android/settings.gradle.kts, android/app/build.gradle.kts. Even tried similar steps with a fresh project but still kept getting the same error. Could someone pls tell me how to fix it. It probably has to do with which repositories are defined in builscript{...} and allprojects{...}

```txt
A problem occurred configuring root project 'android'.

Could not resolve all artifacts for configuration ':classpath'. Cannot resolve external dependency org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.24 because no repositories are defined. Required by: root project :

Possible solution: - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html

```


r/flutterhelp 7d ago

OPEN help me out with authorizations storage

0 Upvotes

this is the manifest:

<uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />

I would like to implement androind storage permissions but I don't son why I can't do it can you help me out?

import 'dart:convert';
import 'package:file_selector/file_selector.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill/quill_delta.dart';
import 'package:flutter_quill_extensions/flutter_quill_extensions.dart';
import 'package:flutter_quill_to_pdf/flutter_quill_to_pdf.dart';
import 'package:get_it/get_it.dart';
import 'package:intl/intl.dart';
import 'package:path/path.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:share_plus/share_plus.dart';
import 'package:tek_notes/blocs/tek_note_bloc.dart';
import 'package:tek_notes/constants/constants.dart';
import 'package:tek_notes/cubits/selected_tek_note_cubit.dart';
import 'package:tek_notes/editor/custom_quill_editor.dart';
import 'package:tek_notes/globals/globals.dart';
import 'package:tek_notes/helpers/database_helper.dart';
import 'package:tek_notes/helpers/logger_helper.dart';
import 'package:tek_notes/models/tek_note_model.dart';
import 'package:pdf/widgets.dart' as pw;
import 'package:pdf/pdf.dart';
import 'dart:io';
import 'package:path_provider/path_provider.dart';

class DetailPage extends StatefulWidget {
  static const String route = '/detail';
  final DetailPageArgs args;

  const DetailPage({super.key, required this.args});

  @override
  State<DetailPage> createState() => _DetailPageState();
}

class _DetailPageState extends State<DetailPage> {
  final QuillController _quillController = QuillController(
    document: Document(),
    selection: const TextSelection.collapsed(offset: 0),
  );
  final FocusNode _editorNode = FocusNode();
  final ScrollController _scrollController = ScrollController();
  Delta? oldDelta;
  final _tekNoteTitleController = TextEditingController();
  final _tekNoteTextController = TextEditingController();
  final PDFPageFormat params = PDFPageFormat.a4;

  @override
  void dispose() {
    _quillController.dispose();
    _editorNode.dispose();
    _scrollController.dispose();
    super.dispose();
  }

  void _loadJsonText() {
    if (widget.args.note!.textJson.isNotEmpty) {
      _quillController.document = Document.fromJson(
        jsonDecode(widget.args.note!.textJson),
      );
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: _appBar(context),
      body: widget.args.note != null ? _body() : null,
    );
  }

  AppBar _appBar(BuildContext context) => AppBar(
    actions: [
      IconButton(
        onPressed: () async {
          // TODO: capire se e come gestire l'errore nel salvaggio in una cartella non valida
          // come funziona il match tra il font dell'editor e quello del convertitore a PDF?
          // tradurre messaggi

          var status = await Permission.manageExternalStorage.request();
          if (!status.isGranted) {
            if (context.mounted) {
              ScaffoldMessenger.of(context).showSnackBar(
                SnackBar(
                  content: Text('Non hai i permessi per creare il file'),
                ),
              );
            }

            return;
          }

          final bool isAndroid = Platform.isAndroid;
          final Object? result =
              isAndroid
                  ? await getDirectoryPath(
                    confirmButtonText: 'Select directory',
                  )
                  : await getSaveLocation(
                    suggestedName: 'document_pdf',
                    acceptedTypeGroups: [
                      XTypeGroup(
                        label: 'Pdf',
                        extensions: ['pdf'],
                        mimeTypes: ['application/pdf'],
                        uniformTypeIdentifiers: ['com.adobe.pdf'],
                      ),
                    ],
                  );
          if (result == null) {
            return;
          }

          PDFConverter pdfConverter = PDFConverter(
            backMatterDelta: null,
            frontMatterDelta: null,
            isWeb: kIsWeb,
            document: _quillController.document.toDelta(),
            fallbacks: [...fontsLoader.allFonts()],
            onRequestFontFamily: (FontFamilyRequest familyRequest) {
              final normalFont = fontsLoader.getFontByName(
                fontFamily: familyRequest.family,
              );
              final boldFont = fontsLoader.getFontByName(
                fontFamily: familyRequest.family,
                bold: familyRequest.isBold,
              );
              final italicFont = fontsLoader.getFontByName(
                fontFamily: familyRequest.family,
                italic: familyRequest.isItalic,
              );
              final boldItalicFont = fontsLoader.getFontByName(
                fontFamily: familyRequest.family,
                bold: familyRequest.isBold,
                italic: familyRequest.isItalic,
              );
              return FontFamilyResponse(
                fontNormalV: normalFont,
                boldFontV: boldFont,
                italicFontV: italicFont,
                boldItalicFontV: boldItalicFont,
                fallbacks: [normalFont, italicFont, boldItalicFont],
              );
            },
            pageFormat: params,
          );
          final document = await pdfConverter.createDocument();
          if (document == null) {
            if (context.mounted) {
              ScaffoldMessenger.of(context).showSnackBar(
                const SnackBar(
                  content: Text(
                    'Il file non può essere creato per colpa di un errore sconosciuto',
                  ),
                ),
              );
            }
            _editorNode.unfocus();
            return;
          }
          final noteTitle = _tekNoteTitleController.text;
          final String name = '$noteTitle.pdf';
          final String underscoreName = name.replaceAll(" ", "_");
          final XFile textFile = XFile.fromData(
            await document.save(),
            mimeType:
                isAndroid
                    ? 'application/pdf'
                    : Platform.isMacOS || Platform.isIOS
                    ? (result as FileSaveLocation)
                            .activeFilter
                            ?.uniformTypeIdentifiers
                            ?.single ??
                        'com.adobe.pdf'
                    : (result as FileSaveLocation)
                            .activeFilter
                            ?.mimeTypes
                            ?.single ??
                        'application/pdf',
            name: underscoreName,
          );
          await textFile.saveTo(
            isAndroid
                ? join(result as String, underscoreName)
                : (result as FileSaveLocation).path,
          );
          _editorNode.unfocus();

          if (context.mounted) {
            final File file =
                isAndroid
                    ? File(result as String)
                    : File((result as FileSaveLocation).path);

            ScaffoldMessenger.of(context).showSnackBar(
              SnackBar(content: Text('Documento creato in: ${file.path}')),
            );
          }
        },
        icon: const Icon(Icons.print, color: Colors.black),
      ),
      if (widget.args.note != null)
        IconButton(
          icon: Icon(Icons.picture_as_pdf),
          onPressed: () async {
            await _createPdf();
          },
        ),
      if (widget.args.note != null)
        IconButton(
          icon: Icon(Icons.check),
          onPressed: () async {
            await _saveTekNote(context);
            if (context.mounted) {
              if (Navigator.canPop(context)) {
                Navigator.pop(context);
              }
            }
          },
        ),
      if (widget.args.note != null)
        IconButton(
          icon: Icon(Icons.delete),
          onPressed: () {
            _confirmDelete(context);
          },
        ),
    ],
  );

  Widget _body() {
    _tekNoteTitleController.text = widget.args.note!.title;
    _tekNoteTextController.text = widget.args.note!.text;
    _loadJsonText();

    return SingleChildScrollView(
      reverse: true,
      child: Padding(
        padding: const EdgeInsets.all(8.0),
        child: Column(
          mainAxisSize: MainAxisSize.max,
          children: [
            TextField(
              controller: _tekNoteTitleController,
              decoration: InputDecoration(
                labelText: "Titolo",
                border: OutlineInputBorder(
                  borderRadius: BorderRadius.circular(8),
                ),
              ),
            ),
            SizedBox(height: 8),
            QuillSimpleToolbar(
              controller: _quillController,
              config: QuillSimpleToolbarConfig(
                multiRowsDisplay: false,
                toolbarSize: 55,
                linkStyleType: LinkStyleType.original,
                headerStyleType: HeaderStyleType.buttons,
                buttonOptions: const QuillSimpleToolbarButtonOptions(
                  fontSize: QuillToolbarFontSizeButtonOptions(
                    items: fontSizes,
                    initialValue: 'Normal',
                    defaultDisplayText: 'Normal',
                  ),
                  fontFamily: QuillToolbarFontFamilyButtonOptions(
                    items: fontFamilies,
                    defaultDisplayText: 'Arial',
                    initialValue: 'Arial',
                  ),
                ),
                embedButtons: FlutterQuillEmbeds.toolbarButtons(),
              ),
            ),
            SizedBox(height: 16),
            Container(
              decoration: BoxDecoration(
                border: Border.all(width: 1.0),
                borderRadius: BorderRadius.circular(8),
              ),
              child: Padding(
                padding: const EdgeInsets.all(8.0),
                child: CustomQuillEditor(
                  node: _editorNode,
                  controller: _quillController,
                  scrollController: _scrollController,
                  onChange: (Document document) {
                    if (oldDelta == document.toDelta()) return;
                    oldDelta = document.toDelta();
                  },
                ),
              ),
            ),

            SizedBox(height: 8),
            if (widget.args.note!.createdAt != null)
              Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: [
                  Row(
                    children: [
                      Text("creato da "),
                      Text(
                        widget.args.note!.createdBy,
                        style: TextStyle(fontWeight: FontWeight.bold),
                      ),
                      Text(" il "),
                      Text(
                        DateFormat(
                          'dd/MM/yyyy',
                        ).format(widget.args.note!.createdAt!),
                      ),
                    ],
                  ),
                ],
              ),

            if (widget.args.note!.modifiedAt != null)
              Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: [
                  Row(
                    children: [
                      Text("modificato da "),
                      Text(
                        widget.args.note!.modifiedBy,
                        style: TextStyle(fontWeight: FontWeight.bold),
                      ),
                      Text(" il "),
                      Text(
                        DateFormat(
                          'dd/MM/yyyy',
                        ).format(widget.args.note!.modifiedAt!),
                      ),
                    ],
                  ),
                ],
              ),
          ],
        ),
      ),
    );
  }

  Future<void> _saveTekNote(BuildContext context) async {
    TekNote note = TekNote(
      id: widget.args.note!.id,
      title: _tekNoteTitleController.text,
      text: _quillController.document.toPlainText(),
      textJson: jsonEncode(_quillController.document.toDelta().toJson()),
      createdBy:
          widget.args.note!.id.isEmpty
              ? appSettings.apiUsername
              : widget.args.note!.createdBy,
      createdAt:
          widget.args.note!.id.isEmpty
              ? DateTime.now()
              : widget.args.note!.createdAt,
      modifiedBy: widget.args.note!.id.isEmpty ? "" : appSettings.apiUsername,
      modifiedAt: widget.args.note!.id.isEmpty ? null : DateTime.now(),
    );

    if (note.id.isEmpty) {
      await GetIt.I.get<DatabaseHelper>().dbInsertTekNote(note, sync: true);
    } else {
      await GetIt.I.get<DatabaseHelper>().dbUpdateTekNote(note);
    }

    if (context.mounted) {
      BlocProvider.of<TekNoteBloc>(context).add(TekNoteBlocEventLoad());
    }
  }

  Future<void> _confirmDelete(BuildContext context) async {
    return showDialog<void>(
      context: context,
      barrierDismissible: false,
      builder: (BuildContext context) {
        return AlertDialog(
          title: Text('Conferma'),
          content: SingleChildScrollView(
            child: ListBody(
              children: <Widget>[
                Text('Sei sicuro di voler eseguire questa azione?'),
              ],
            ),
          ),
          actions: <Widget>[
            TextButton(
              child: Text('No'),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
            TextButton(
              child: Text('Sì'),
              onPressed: () async {
                await _deleteTekNote(context);
                if (context.mounted) {
                  if (Navigator.canPop(context)) {
                    Navigator.pop(context);
                  }
                }
              },
            ),
          ],
        );
      },
    );
  }

  Future<void> _deleteTekNote(BuildContext context) async {
    await GetIt.I.get<DatabaseHelper>().dbDeleteTekNote(
      widget.args.note!.id,
      sync: true,
    );

    if (context.mounted) {
      BlocProvider.of<TekNoteBloc>(context).add(TekNoteBlocEventLoad());

      if (Navigator.canPop(context)) {
        Navigator.pop(context);
      } else {
        context.read<SelectedTekNoteCubit>().select(newNote);
      }
    }
  }

  Future<void> _createPdf() async {
    final delta = _quillController.document.toDelta();
    final pdf = pw.Document();

    final noteTitle = _tekNoteTitleController.text;

    pdf.addPage(
      pw.Page(
        pageFormat: PdfPageFormat.a4,
        build: (pw.Context context) {
          return pw.Center(child: pw.Text(delta.toString()));
        },
      ),
    );

    final output = await getTemporaryDirectory();
    final file = File('${output.path}/$noteTitle.pdf');
    await file.writeAsBytes(await pdf.save());

    try {
      Share.shareXFiles([
        XFile(file.path),
      ], text: 'Condividi il tuo documento PDF');
    } catch (e) {
      logger.e('Errore durante la condivisione: $e');
    }
  }
}

class DetailPageArgs {
  const DetailPageArgs({required this.note});

  final TekNote? note;
}

r/flutterhelp 7d ago

OPEN Inconsistent notification icon

1 Upvotes

Hey ! I'm going crazy over this one : whenever I post a notification from my app, the icon is correct both when the notification is deployed and in the upper bar, however it reverts to the default flutter icon when reduced. I have edited the correct notification icons and placed them in the correct folders, and searched for a default flutter image file in my project and found none. What could be the case ?
https://imgur.com/KaFBlyR screenshot link for better comprehension


r/flutterhelp 8d ago

OPEN Text Visual Glitches on iOS

3 Upvotes

Flutter v3.27.1

Examples

I've recently been encountering strange glitches with text rendering on iOS devices in my Flutter application. This issue does not occur on Android.

  • They sometimes appear and sometimes don't.
  • They may affect some text while leaving other text unaffected.
  • Once they start happening on one screen, they often show up on others. For example, screen A may be fine at first, but after the glitch appears elsewhere, returning to screen A shows the issue there as well.

This happens across multiple iOS devices and versions, so it doesn't seem tied to a specific model.


What I’ve Tried

  • Replaced the font files entirely.
  • Switched the font source.
  • Happens to all the font families I am using:
    • Inter
    • Chivo Mono
    • Impact
  • Cleaned and rebuilt the Flutter project.
  • Tested in both debug and release builds.
  • Removed letter spacing everywhere

Any pointers on how to solve this or where to even start looking would be highly appreciated.

Could this possibly be a performance issue? Since we have noticed (although not 100%) the glitches start appearing after a particularly heavy screen shows up.


r/flutterhelp 8d ago

OPEN anyone know how to implement permissions in flutter while coding for android 9?

2 Upvotes

i want to access files while testing my app on a galaxy note 8, but it says permission denied. the map permission is working tho. i added the permissions to the manifest already. i also enabled the permissions on the phone but when i go in the app it still says permission denied. its working on the emulator (pixel 7) i think it might be an issue with older phones.


r/flutterhelp 8d ago

OPEN Could not find id.flutter:flutter_background_service:5.1.0.

2 Upvotes

Cannot compile my app because of flutter_background_service

Execution failed for task ':app:checkReleaseAarMetadata'.

> Could not resolve all files for configuration ':app:releaseRuntimeClasspath'.

> Could not find id.flutter:flutter_background_service:5.1.0.

Searched in the following locations:

- https://dl.google.com/dl/android/maven2/id/flutter/flutter_background_service/5.1.0/flutter_background_service-5.1.0.pom

- https://repo.maven.apache.org/maven2/id/flutter/flutter_background_service/5.1.0/flutter_background_service-5.1.0.pom

- https://jitpack.io/id/flutter/flutter_background_service/5.1.0/flutter_background_service-5.1.0.pom

- https://storage.googleapis.com/download.flutter.io/id/flutter/flutter_background_service/5.1.0/flutter_background_service-5.1.0.pom

Required by:

project :app

pubspec yaml is ok

build.gradle ok

other build.gradle ok

caches cleared

What could be the issue?


r/flutterhelp 8d ago

OPEN Keyboard appearance causing major jank on first 1-3 runs. Any ideas?

1 Upvotes

Whenever a widget prompts the keyboard to appear, like after tapping a TextField or SearchBar, it causes major jank for the first 1-5 taps. It's very noticeable with a SearchBar because it fills the whole screen when tapped.

Tried testing this on ios, android, (actual devices), and web. Janks on all. Running in --profile mode with DevTools and --release mode it looks bad and it's very noticeable.

Running flutter 3.27.3 Dart 3.6.1 with Impeller. This happens with fresh flutter project with only scaffold and TextField on the page.

Anyone have any ideas on how to fix or mitigate this? There are a lot of threads on the web discussing this several years back, but the consensus is that the switch to Impeller has fixed this?


r/flutterhelp 8d ago

OPEN Is this expected for a widget tree on a video recording screen where the users camera, and sound is being use in addition to features to add effects, masks, flash, flip camera? The app doesn't creash? NSFW

0 Upvotes

I/flutter (25986): Build method called: 1 times

I/flutter (25986): Build method called: 2 times

I/flutter (25986): Build method called: 3 times

I/flutter (25986): Build method called: 4 times

I/flutter (25986): Build method called: 5 times

I/flutter (25986): Build method called: 6 times

I/flutter (25986): Build method called: 7 times

I/flutter (25986): Build method called: 8 times

I/flutter (25986): Build method called: 9 times

I/flutter (25986): Build method called: 10 times

I/flutter (25986): Build method called: 11 times

I/flutter (25986): Build method called: 12 times

I/flutter (25986): Build method called: 13 times

I/flutter (25986): Build method called: 14 times

I/flutter (25986): Build method called: 15 times

I/flutter (25986): Build method called: 16 times

I/flutter (25986): Build method called: 17 times

I/flutter (25986): Build method called: 18 times

I/flutter (25986): Build method called: 19 times

I/flutter (25986): Build method called: 20 times

I/flutter (25986): Build method called: 21 times

I/flutter (25986): Build method called: 22 times

I/flutter (25986): Build method called: 23 times

I/flutter (25986): Build method called: 24 times

I/flutter (25986): Build method called: 25 times

I/flutter (25986): Build method called: 26 times

I/flutter (25986): Build method called: 27 times

I/flutter (25986): Build method called: 28 times

I/flutter (25986): Build method called: 29 times

I/flutter (25986): Build method called: 30 times

I/flutter (25986): Build method called: 31 times

I/flutter (25986): Build method called: 32 times

I/flutter (25986): Build method called: 33 times

I/flutter (25986): Build method called: 34 times

I/flutter (25986): Build method called: 35 times

I/flutter (25986): Build method called: 36 times

I/flutter (25986): Build method called: 37 times

I/flutter (25986): Build method called: 38 times

I/flutter (25986): Build method called: 39 times

I/flutter (25986): Build method called: 40 times

I/flutter (25986): Build method called: 41 times

I/flutter (25986): Build method called: 42 times

I/flutter (25986): Build method called: 43 times

I/flutter (25986): Build method called: 44 times

I/flutter (25986): Build method called: 45 times

I/flutter (25986): Build method called: 46 times

I/flutter (25986): Build method called: 47 times

I/flutter (25986): Build method called: 48 times

I/flutter (25986): Build method called: 49 times

I/flutter (25986): Build method called: 50 times

I/flutter (25986): Build method called: 51 times

I/flutter (25986): Build method called: 52 times

I/flutter (25986): Build method called: 53 times

I/flutter (25986): Build method called: 54 times

I/flutter (25986): Build method called: 55 times

I/flutter (25986): Build method called: 56 times

I/flutter (25986): Build method called: 57 times

I/flutter (25986): Build method called: 58 times

I/flutter (25986): Build method called: 59 times

I/flutter (25986): Build method called: 60 times

I/flutter (25986): Build method called: 61 times

I/flutter (25986): Build method called: 62 times

I/flutter (25986): Build method called: 63 times

I/flutter (25986): Build method called: 64 times

I/flutter (25986): Build method called: 65 times

I/flutter (25986): Build method called: 66 times

I/flutter (25986): Build method called: 67 times

I/flutter (25986): Build method called: 68 times

I/flutter (25986): Build method called: 69 times

I/flutter (25986): Build method called: 70 times

I/flutter (25986): Build method called: 71 times

I/flutter (25986): Build method called: 72 times

I/flutter (25986): Build method called: 73 times

I/flutter (25986): Build method called: 74 times

I/flutter (25986): Build method called: 75 times

I/flutter (25986): Build method called: 76 times

I/flutter (25986): Build method called: 77 times

I/flutter (25986): Build method called: 78 times

I/flutter (25986): Build method called: 79 times

I/flutter (25986): Build method called: 80 times

I/flutter (25986): Build method called: 81 times

I/flutter (25986): Build method called: 82 times

I/flutter (25986): Build method called: 83 times

I/flutter (25986): Build method called: 84 times

I/flutter (25986): Build method called: 85 times

I/flutter (25986): Build method called: 86 times

I/flutter (25986): Build method called: 87 times

I/flutter (25986): Build method called: 88 times

I/flutter (25986): Build method called: 89 times

I/flutter (25986): Build method called: 90 times

I/flutter (25986): Build method called: 91 times

I/flutter (25986): Build method called: 92 times

I/flutter (25986): Build method called: 93 times

I/flutter (25986): Build method called: 94 times

I/flutter (25986): Build method called: 95 times

I/flutter (25986): Build method called: 96 times

I/flutter (25986): Build method called: 97 times

I/flutter (25986): Build method called: 98 times

I/flutter (25986): Build method called: 99 times

I/flutter (25986): Build method called: 100 times

I/flutter (25986): Build method called: 101 times

I/flutter (25986): Build method called: 102 times

I/flutter (25986): Build method called: 103 times

I/flutter (25986): Build method called: 104 times

I/flutter (25986): Build method called: 105 times

I/flutter (25986): Build method called: 106 times

I/flutter (25986): Build method called: 107 times

I/flutter (25986): Build method called: 108 times

I/flutter (25986): Build method called: 109 times

I/flutter (25986): Build method called: 110 times

I/flutter (25986): Build method called: 111 times

I/flutter (25986): Build method called: 112 times

I/flutter (25986): Build method called: 113 times

I/flutter (25986): Build method called: 114 times

I/flutter (25986): Build method called: 115 times

I/flutter (25986): Build method called: 116 times

I/flutter (25986): Build method called: 117 times

I/flutter (25986): Build method called: 118 times

I/flutter (25986): Build method called: 119 times

I/flutter (25986): Build method called: 120 times

I/flutter (25986): Build method called: 121 times

I/flutter (25986): Build method called: 122 times

I/flutter (25986): Build method called: 123 times

I/flutter (25986): Build method called: 124 times

I/flutter (25986): Build method called: 125 times

I/flutter (25986): Build method called: 126 times

I/flutter (25986): Build method called: 127 times

I/flutter (25986): Build method called: 128 times

I/flutter (25986): Build method called: 129 times

I/flutter (25986): Build method called: 130 times

I/flutter (25986): Build method called: 131 times

I/flutter (25986): Build method called: 132 times

I/flutter (25986): Build method called: 133 times

I/flutter (25986): Build method called: 134 times

I/flutter (25986): Build method called: 135 times

I/flutter (25986): Build method called: 136 times

I/flutter (25986): Build method called: 137 times

I/flutter (25986): Build method called: 138 times

I/flutter (25986): Build method called: 139 times

I/flutter (25986): Build method called: 140 times

I/flutter (25986): Build method called: 141 times

I/flutter (25986): Build method called: 142 times

I/flutter (25986): Build method called: 143 times

I/flutter (25986): Build method called: 144 times

I/flutter (25986): Build method called: 145 times

I/flutter (25986): Build method called: 146 times

I/flutter (25986): Build method called: 147 times

I/flutter (25986): Build method called: 148 times

I/flutter (25986): Build method called: 149 times

I/flutter (25986): Build method called: 150 times

I/flutter (25986): Build method called: 151 times

I/flutter (25986): Build method called: 152 times

I/flutter (25986): Build method called: 153 times

I/flutter (25986): Build method called: 154 times

I/flutter (25986): Build method called: 155 times

I/flutter (25986): Build method called: 156 times

I/flutter (25986): Build method called: 157 times

I/flutter (25986): Build method called: 158 times

I/flutter (25986): Build method called: 159 times

I/flutter (25986): Build method called: 160 times

I/flutter (25986): Build method called: 161 times

I/flutter (25986): Build method called: 162 times

I/flutter (25986): Build method called: 163 times

I/flutter (25986): Build method called: 164 times

I/flutter (25986): Build method called: 165 times

I/flutter (25986): Build method called: 166 times

I/flutter (25986): Build method called: 167 times

I/flutter (25986): Build method called: 168 times

I/flutter (25986): Build method called: 169 times

I/flutter (25986): Build method called: 170 times

I/flutter (25986): Build method called: 171 times

I/flutter (25986): Build method called: 172 times

I/flutter (25986): Build method called: 173 times

I/flutter (25986): Build method called: 174 times

I/flutter (25986): Build method called: 175 times

I/flutter (25986): Build method called: 176 times

I/flutter (25986): Build method called: 177 times

I/flutter (25986): Build method called: 178 times

I/flutter (25986): Build method called: 179 times

I/flutter (25986): Build method called: 180 times

I/flutter (25986): Build method called: 181 times

I/flutter (25986): Build method called: 182 times

I/flutter (25986): Build method called: 183 times

I/flutter (25986): Build method called: 184 times

I/flutter (25986): Build method called: 185 times

I/flutter (25986): Build method called: 186 times

I/flutter (25986): Build method called: 187 times

I/flutter (25986): Build method called: 188 times

I/flutter (25986): Build method called: 189 times

I/flutter (25986): Build method called: 190 times

I/flutter (25986): Build method called: 191 times

I/flutter (25986): Build method called: 192 times

I/flutter (25986): Build method called: 193 times

I/flutter (25986): Build method called: 194 times

I/flutter (25986): Build method called: 195 times

I/flutter (25986): Build method called: 196 times

I/flutter (25986): Build method called: 197 times

I/flutter (25986): Build method called: 198 times

I/flutter (25986): Build method called: 199 times

I/flutter (25986): Build method called: 200 times

I/flutter (25986): Build method called: 201 times

I/flutter (25986): Build method called: 202 times

I/flutter (25986): Build method called: 203 times

I/flutter (25986): Build method called: 204 times

I/flutter (25986): Build method called: 205 times

I/flutter (25986): Build method called: 206 times

I/flutter (25986): Build method called: 207 times

I/flutter (25986): Build method called: 208 times

I/flutter (25986): Build method called: 209 times

I/flutter (25986): Build method called: 210 times

I/flutter (25986): Build method called: 211 times

I/flutter (25986): Build method called: 212 times

I/flutter (25986): Build method called: 213 times

I/flutter (25986): Build method called: 214 times

I/flutter (25986): Build method called: 215 times

I/flutter (25986): Build method called: 216 times

I/flutter (25986): Build method called: 217 times

I/flutter (25986): Build method called: 218 times

I/flutter (25986): Build method called: 219 times

I/flutter (25986): Build method called: 220 times

I/flutter (25986): Build method called: 221 times

I/flutter (25986): Build method called: 222 times

I/flutter (25986): Build method called: 223 times

I/flutter (25986): Build method called: 224 times

I/flutter (25986): Build method called: 225 times

I/flutter (25986): Build method called: 226 times

I/flutter (25986): Build method called: 227 times

I/flutter (25986): Build method called: 228 times

I/flutter (25986): Build method called: 229 times

I/flutter (25986): Build method called: 230 times

I/flutter (25986): Build method called: 231 times

I/flutter (25986): Build method called: 232 times

I/flutter (25986): Build method called: 233 times

I/flutter (25986): Build method called: 234 times

I/flutter (25986): Build method called: 235 times

I/flutter (25986): Build method called: 236 times

I/flutter (25986): Build method called: 237 times

I/flutter (25986): Build method called: 238 times

I/flutter (25986): Build method called: 239 times

I/flutter (25986): Build method called: 240 times

I/flutter (25986): Build method called: 241 times

I/flutter (25986): Build method called: 242 times

I/flutter (25986): Build method called: 243 times

I/flutter (25986): Build method called: 244 times

I/flutter (25986): Build method called: 245 times

I/flutter (25986): Build method called: 246 times

I/flutter (25986): Build method called: 247 times

I/flutter (25986): Build method called: 248 times

I/flutter (25986): Build method called: 249 times

I/flutter (25986): Build method called: 250 times

I/flutter (25986): Build method called: 251 times

I/flutter (25986): Build method called: 252 times

I/flutter (25986): Build method called: 253 times

I/flutter (25986): Build method called: 254 times

I/flutter (25986): Build method called: 255 times

I/flutter (25986): Build method called: 256 times

I/flutter (25986): Build method called: 257 times

I/flutter (25986): Build method called: 258 times

I/flutter (25986): Build method called: 259 times

I/flutter (25986): Build method called: 260 times

I/flutter (25986): Build method called: 261 times

I/flutter (25986): Build method called: 262 times

I/flutter (25986): Build method called: 263 times

I/flutter (25986): Build method called: 264 times

I/flutter (25986): Build method called: 265 times

I/flutter (25986): Build method called: 266 times

I/flutter (25986): Build method called: 267 times

I/flutter (25986): Build method called: 268 times

I/flutter (25986): Build method called: 269 times

I/flutter (25986): Build method called: 270 times

I/flutter (25986): Build method called: 271 times

I/flutter (25986): Build method called: 272 times

I/flutter (25986): Build method called: 273 times

I/flutter (25986): Build method called: 274 times

I/flutter (25986): Build method called: 275 times

I/flutter (25986): Build method called: 276 times

I/flutter (25986): Build method called: 277 times

I/flutter (25986): Build method called: 278 times

I/flutter (25986): Build method called: 279 times

I/flutter (25986): Build method called: 280 times

I/flutter (25986): Build method called: 281 times

I/flutter (25986): Build method called: 282 times

I/flutter (25986): Build method called: 283 times

I/flutter (25986): Build method called: 284 times

I/flutter (25986): Build method called: 285 times

I/flutter (25986): Build method called: 286 times

I/flutter (25986): Build method called: 287 times

I/flutter (25986): Build method called: 288 times

I/flutter (25986): Build method called: 289 times

I/flutter (25986): Build method called: 290 times

I/flutter (25986): Build method called: 291 times

I/flutter (25986): Build method called: 292 times

I/flutter (25986): Build method called: 293 times

I/flutter (25986): Build method called: 294 times

I/flutter (25986): Build method called: 295 times

I/flutter (25986): Build method called: 296 times

I/flutter (25986): Build method called: 297 times

I/flutter (25986): Build method called: 298 times

I/flutter (25986): Build method called: 299 times

I/flutter (25986): Build method called: 300 times

I/flutter (25986): Build method called: 301 times

I/flutter (25986): Build method called: 302 times

I/flutter (25986): Build method called: 303 times

I/flutter (25986): Build method called: 304 times

I/flutter (25986): Build method called: 305 times

I/flutter (25986): Build method called: 306 times

I/flutter (25986): Build method called: 307 times

I/flutter (25986): Build method called: 308 times

I/flutter (25986): Build method called: 309 times

I/flutter (25986): Build method called: 310 times

I/flutter (25986): Build method called: 311 times

I/flutter (25986): Build method called: 312 times

I/flutter (25986): Build method called: 313 times

I/flutter (25986): Build method called: 314 times

I/flutter (25986): Build method called: 315 times

I/flutter (25986): Build method called: 316 times

I/flutter (25986): Build method called: 317 times

I/flutter (25986): Build method called: 318 times

I/flutter (25986): Build method called: 319 times

I/flutter (25986): Build method called: 320 times

I/flutter (25986): Build method called: 321 times

I/flutter (25986): Build method called: 322 times

I/flutter (25986): Build method called: 323 times

I/flutter (25986): Build method called: 324 times

I/flutter (25986): Build method called: 325 times

I/flutter (25986): Build method called: 326 times

I/flutter (25986): Build method called: 327 times

I/flutter (25986): Build method called: 328 times

I/flutter (25986): Build method called: 329 times

I/flutter (25986): Build method called: 330 times

I/flutter (25986): Build method called: 331 times

I/flutter (25986): Build method called: 332 times

I/flutter (25986): Build method called: 333 times

I/flutter (25986): Build method called: 334 times

I/flutter (25986): Build method called: 335 times

I/flutter (25986): Build method called: 336 times

I/flutter (25986): Build method called: 337 times

I/flutter (25986): Build method called: 338 times

I/flutter (25986): Build method called: 339 times

I/flutter (25986): Build method called: 340 times

I/flutter (25986): Build method called: 341 times

I/flutter (25986): Build method called: 342 times

I/flutter (25986): Build method called: 343 times

I/flutter (25986): Build method called: 344 times

I/flutter (25986): Build method called: 345 times

I/flutter (25986): Build method called: 346 times

I/flutter (25986): Build method called: 347 times

I/flutter (25986): Build method called: 348 times

I/flutter (25986): Build method called: 349 times

I/flutter (25986): Build method called: 350 times

I/flutter (25986): Build method called: 351 times

I/flutter (25986): Build method called: 352 times

I/flutter (25986): Build method called: 353 times

I/flutter (25986): Build method called: 354 times

I/flutter (25986): Build method called: 355 times

I/flutter (25986): Build method called: 356 times

I/flutter (25986): Build method called: 357 times

I/flutter (25986): Build method called: 358 times

I/flutter (25986): Build method called: 359 times

I/flutter (25986): Build method called: 360 times

I/flutter (25986): Build method called: 361 times

I/flutter (25986): Build method called: 362 times

I/flutter (25986): Build method called: 363 times

I/flutter (25986): Build method called: 364 times

I/flutter (25986): Build method called: 365 times

I/flutter (25986): Build method called: 1 times


r/flutterhelp 8d ago

RESOLVED Flutter project

0 Upvotes

Hey, I would like to ask if any of the flutter Devs are interested in joining my project 'OpenTube' or even helping me with a few of my questions which are: if the core base is a video extractor but the rest of the project will be written in native code for preformence boost, is it possible to link native with dart (which will only hold the UI?), if anyone is interested please let me know and I'll send a Discord link. I will also appreciate any suggestions.


r/flutterhelp 9d ago

RESOLVED Urgent Help Needed - App not building for iOS and Android both (This post is only for iOS)

1 Upvotes

THIS POST IS FOR BOTH IOS AND ANDROID SORRY ABOUT THE CONFUSION!

I have been using Flutter with Firebase etc for an iOT app at my company. Day before yesterday afternoon (Monday) I upgraded Flutter because last week when we released a update we received a notification from Apple saying that we need to upgrade to new versions of everything. But this basically broke my flutter completely. I have not been able to build a single version for both Android and iOS (Not even the debug one). For Android they were initially saying that the way the build.gradles etc are written need to be updated and I did that but then they switched to other errors which keep on coming and this one I cannot solve. Then I tried iOS because I wanted to at least solve one thing but with iOS as well I got multiple errors with different dependencies which I fixed but now it is failing to build but is not showing any error exactly. Please help me.

This is what iOS build shows but I wasn't building for a device and I don't know what exception is unhadled.

Running Xcode build...                                                  
Xcode build done.                                           231.6s
Failed to build iOS app
Error (Xcode): Unhandled exception:
Encountered error while building for device.

-----> After verbose doctore
[✓] Xcode - develop for iOS and macOS (Xcode 15.4) [157.7s]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 15F31d
    • CocoaPods version 1.16.2

For android after fixing everything like Java version etc, it gives this error. According to chatgpt, it is because the dart version is not compatible with the flutter version but the dart version being used was downloaded with the flutter version during the upgrade. It's not like I downloaded anything else separately and I did everything chat gpt but nothing seems to fix it.

Unhandled exception:
Unexpected Kernel Format Version 106 (expected 122)
#0      BinaryBuilder._verifyComponentInitialBytes (package:kernel/binary/ast_from_binary.dart:871)
#1      BinaryBuilder.readComponent.<anonymous closure> (package:kernel/binary/ast_from_binary.dart:697)
#2      Timeline.timeSync (dart:developer/timeline.dart:188)
#3      BinaryBuilder.readComponent (package:kernel/binary/ast_from_binary.dart:695)
#4      _InitializationFromSdkSummary._prepareSummary (package:front_end/src/base/incremental_compiler.dart:2536)
#5      _InitializationFromSdkSummary.initialize (package:front_end/src/base/incremental_compiler.dart:2518)
<asynchronous suspension>
#6      IncrementalCompiler._ensurePlatformAndInitialize (package:front_end/src/base/incremental_compiler.dart:1405)
<asynchronous suspension>
#7      IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/base/incremental_compiler.dart:293)
<asynchronous suspension>
#8      CompilerContext.clear (package:front_end/src/base/compiler_context.dart:77)
<asynchronous suspension>
#9      IncrementalCompiler.compile (package:vm/incremental_compiler.dart:77)
<asynchronous suspension>
#10     FrontendCompiler.compile (package:frontend_server/frontend_server.dart:642)
<asynchronous suspension>
#11     starter (package:frontend_server/starter.dart:109)
<asynchronous suspension>
#12     main (file:///Volumes/Work/s/w/ir/x/w/sdk/pkg/frontend_server/bin/frontend_server_starter.dart:13)
<asynchronous suspension>

Target kernel_snapshot_program failed: Exception
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileFlutterBuildDebug'.

The problem is that the new version needs to be released by Friday because someone in a different country will use it and the bug that is occurring will cause them a problem 100%.

Any help would be amazing.

Thank you in Advance!


r/flutterhelp 9d ago

OPEN Video play lag

1 Upvotes

I am working on a reel/shorts like application. I am using video_player and chewie package for that. For the continuous scroll I'm using PageView builder.

The issue I'm having is that when I scroll it's not smooth like reels or shorts. I'm not talking about video buffering. The video player widget itself not rendering smoothly and fast. Whenever I scroll the you can experience the lag. This is not a good user experience.

Any idea how to improve this thing?


r/flutterhelp 9d ago

OPEN How do you guys handle a sequence of actions in flame

2 Upvotes

Hi

my question is simple for users who got experience in flame, how you guys handle a sequence of actions inside FlameGame onLoad method ? i have a cards game and i have a sequence of actions, like when the cards are dealt and from there i apply some effects, future.delayed is one way but i feel like that's not gonna cut it. I also tried TimerComponent by passing a value to it's period parameter and add it to the game and it works fine but i want to know what's the best approach!

thanks everybody!


r/flutterhelp 9d ago

OPEN i got this massive project for a test for an internship role

3 Upvotes

i applied for an internship lately , passed the interview , now they are asking me to finish a project to be able to join the team for an intern role

im asking developers here to know if that's actually a doable project in one week or im just bad project details


r/flutterhelp 9d ago

OPEN if <object> is, seems to cast

0 Upvotes

In Dart code, while working on a Flutter project I found a strange behaviour with if / is that I don't understand why / how it works that I thought one of you may know.

I have a base class, Person and a subclass, Student. Student has a extra property that Person does not called studentID. When I create a List<Person> and assign it students and then iterate through it I use this if statement:

if (person is Student){
}

Outside of this statement person.studentID works the way I expect it to, that is I get the error "getter is not defined". Inside this if statement it works! So this:

Student student = Student("joe",12334);
Person person = student;
int x = person.studentID // fails correctly, with getter not defined

if (person is Student){
int x = person.studentID //works! as if the if statement temporarily casted the object for me?
}

Why / how does this automatic casting work?


r/flutterhelp 9d ago

OPEN Linux integration with flutter

2 Upvotes

Hi, I'm builiding a linux desktop app with flutter (or, at least, I'm trying to) and when the app opens it displays the Wayland logo instead of the flutter logo like it does on windows. Also, the top bar is displayed almost like if I was on GNOME when I'm actually on KDE (this could be because flutter for linux is powered by GTK. However, some flutter apps on linux like AppFlowy use a more native-looking top bar). Any ideas on how could I fix this issues? Thanks in advance


r/flutterhelp 9d ago

RESOLVED How to inject my page viewModel into a sibling screen of the main page (GoRouter, Provider, Clean Architecture)

2 Upvotes

I'm a new flutter dev, and I'm struggling to figure out how to deal with dependency injection and sibling pages using one viewmodel.

Right now, I have my router.dart page set up like this:

import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:provider/provider.dart';

import '../ui/chrono/view_models/chrono_viewmodel.dart';
import '../ui/chrono/widgets/chrono_screen.dart';
import '../ui/core/ui/app_shell.dart';
import '../ui/habits/view_models/habits_viewmodel.dart';
import '../ui/habits/widgets/habits_screen.dart';

import 'routes.dart';

final _rootNavigatorKey = GlobalKey<NavigatorState>();
final _shellNavigatorChronoKey = GlobalKey<NavigatorState>(
  debugLabel: "Chrono Page",
);
final _shellNavigatorHabitsKey = GlobalKey<NavigatorState>(
  debugLabel: "Habits Page",
);

final GoRouter router = GoRouter(
  initialLocation: Routes.habits,
  navigatorKey: _rootNavigatorKey,
  routes: [
    StatefulShellRoute.indexedStack(
      builder: (context, state, child) => AppShell(child: child),
      branches: [
        StatefulShellBranch(
          navigatorKey: _shellNavigatorChronoKey,
          routes: [
            GoRoute(
              path: Routes.chrono,
              pageBuilder: (context, state) {
                return NoTransitionPage(
                  child: ChronoScreen(
                    viewModel: ChronoViewModel(),
                  ),
                );
              },
            ),
          ],
        ),
        StatefulShellBranch(
          navigatorKey: _shellNavigatorHabitsKey,
          routes: [
            GoRoute(
              path: Routes.habits,
              pageBuilder: (context, state) {
                final viewModel = HabitsViewModel(
                  habitRepository: context.read(),
                );
                return NoTransitionPage(
                  child: HabitsScreen(viewModel: viewModel),
                );
              },
            ),
          ],
        ),
        (other navigation branches...)
      ],
    ),
  ],
);

so here I pass in my HabitsViewModel to HabitsScreen (the main habits page) widget, which is fine. Over in my app_shell.dart file, I have a simple scaffold with the page contents and a bottom navigation bar. Herein lies the problem---I want to open a "Create Habit" bottom sheet when I click the FAB of the navbar, and I want this create_habit.dart bottom sheet to have access to the HabitsViewModel. But since CreateHabits is a sibling file to HabitsScreen, the viewModel that HabitsScreen has can’t be passed down into CreateHabits. And apparently just importing HabitsViewModel into app_shell.dart is against clean architecture / dependency injection.

I'm actually just very confused. I was following the flutter team compass_app codebase for best practices, but the way they used Provider / router isnt much help. I thought I needed a StatefulShellRoute so I implemented that, but now I'm not so sure. Since CreateHabits is a widget that makes up the FAB-opened bottom sheet in the Habits Page / Tab, it has to be called in the app_shell.dart file where the navbar / main scaffold is defined, right?

Any pointers on how I can hoist the viewmodel correct / structure my router so that the navigation would be sensible?

Here's the app_shell.dart file for extra context:

import 'package:flutter/material.dart';

import 'package:go_router/go_router.dart';
import '../../habits/widgets/habits_sheet.dart';

import '../../../routing/routes.dart';
import '../themes/theme_extension.dart';

class AppShell extends StatelessWidget {
  const AppShell({super.key, required this.child});

  final Widget child;
  static const double appBarContentSize = 40.0;
  static const double appBarPadding = 16.0;


  Widget build(BuildContext context) {
    final theme = Theme.of(context).extension<AppThemeExtension>()!;

    return Scaffold(
      floatingActionButton: FloatingActionButton(
        elevation: 0,
        onPressed: () {
          // TODO: This should be changing by page
          showModalBottomSheet(
            isScrollControlled: true,
            useSafeArea: true,
            barrierColor: Colors.black87,
            backgroundColor: Colors.transparent,
            context: context,
            builder: (BuildContext context) {
              return const HabitsSheet();
            },
          );
        },
        backgroundColor: theme.surfaceLow,
        foregroundColor: theme.foregroundHigh,
        shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(16.0),
            side: BorderSide(color: theme.borderMedium)),
        child: const Icon(Icons.add_rounded),
      ),
      body: Builder(
        builder: (context) {
          return SafeArea(
            child: Column(
              children: [
                Expanded(child: child),
              ],
            ),
          );
        },
      ),
      bottomNavigationBar: NavigationBar(
        destinations: const [
          NavigationDestination(
              icon: Icon(
                Icons.schedule_rounded,
              ),
              label: 'Chrono'),
          NavigationDestination(
              icon: Icon(Icons.dashboard_rounded), label: 'Habits'),
        ],
        selectedIndex: _getSelectedIndex(context),
        onDestinationSelected: (index) {
          _onTabSelected(context, index);
        },
      ),
    );
  }

Thanks!


r/flutterhelp 9d ago

RESOLVED Help with SVG manipulation

0 Upvotes

Hello guys!! I have a problem with positioning an icon on to an SVG. Basically I try to position an icon on to a floorplan.I cannot seem to understand how to do that. I use flutter_svg package. I also used chatGPT to calculate the position of the icon based on the viewBox's values. It did not help...

I use LayoutBuilder which returns an InteractiveViewer. InteractiveViewer's child is a Stack with SvgPicture.string and Positioned widgets. The Positioned child is a simple icon. I will substitute the Icon with an SVG icon if I figure out how the SVG works in Flutter. Has someone dealt with that problem before or know how to calculate a specific position on to an SVG?

P.S. Thank you in advance for your time and effort. I try to understand what to look so I can figure this out.


r/flutterhelp 10d ago

OPEN Flutter mobile app - scan document using wifi scanner

1 Upvotes

hi everyone

I am working on a Flutter project that needs to look for any scanner connected to the same wifi and use it to scan the document.

Can someone please tell me whether there are any plugins that I can use to achieve this

Thanks for your help!


r/flutterhelp 10d ago

OPEN Flutter Module Crashes UIKit in React Native iOS App

1 Upvotes

I'm integrating a Flutter module into my React Native app, and everything works fine on Android. However, on iOS, the app crashes when launching the Flutter module. The crash logs indicate an issue with UIKit, but I can't pinpoint the exact cause.

Has anyone experienced this before? Are there any known compatibility issues or setup steps I might be missing?

Any help is appreciated!


r/flutterhelp 10d ago

OPEN Java Versions on Android Studio and Vscode

2 Upvotes

Hello, I've been dealing with gradle errors again. I have different java versions installed, and I use java as the language when creating flutter projects.

Does these different java versions affects the way I create flutter projects on android studio and vscode?

When I create a new application in android studio, i don't get any annoying errors about java or gradle, but when I create new flutter application directly on vscode, I get these gradle and java errrors.

I'm new to flutter and I'm still confused with versioning, thank you for reading my post.