Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appModel.appType is unreliable #3181

Open
csells opened this issue Mar 5, 2025 · 0 comments
Open

appModel.appType is unreliable #3181

csells opened this issue Mar 5, 2025 · 0 comments
Assignees

Comments

@csells
Copy link
Collaborator

csells commented Mar 5, 2025

What happened?

The Update Existing Code dialog depends on the value of appModel.appType to determine if the user is updating Dart or Flutter code. However, it appears as if the user's Flutter code hasn't been executed, the value of appModel.appType will be reported as Dart instead of Flutter. This sometimes causes the LLM to translate the user's code from Flutter to Dart during the update process.

Steps to reproduce problem

  • Choose Samples | Hello World and execute the program to reset appModel.appType to Dart.
  • Choose Samples | Counter and be careful NOT to execute the program.
  • Choose Gemini | Update Code and the Update Existing Code dialog will think that the Flutter Counter app code is Dart and not Flutter.
Image

Browser

Google Chrome
Version 133.0.6943.142 (Official Build) (arm64)

Are you using any extensions/plugins that affect website behavior
(particularly those that affect iframes, such as ad blockers)? No

Are there any warnings or errors in your browser's JavaScript console?
If so, paste them below:

<meta name="apple-mobile-web-app-capable" content="yes"> is deprecated. Please include <meta name="mobile-web-app-capable" content="yes">Understand this warningAI
111Chrome is moving towards a new experience that allows users to choose to browse without third-party cookies.

Machine

Operating system: macOS
Version: 15.3.1 (24D70)

Your code

What code was in the editor, if any, when the failure occurred? You
can paste it in below:

import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      debugShowCheckedModeBanner: false,
      theme: ThemeData(colorSchemeSeed: Colors.blue),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  final String title;

  const MyHomePage({super.key, required this.title});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {
      _counter++;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text(widget.title)),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            const Text('You have pushed the button this many times:'),
            Text(
              '$_counter',
              style: Theme.of(context).textTheme.headlineMedium,
            ),
          ],
        ),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ),
    );
  }
}

DartPad's output

Did DartPad print anything to the console pane? If so, paste it below:

If you were running Flutter code, you can also paste an image of the
Flutter output directly into this bug report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants