Skip to content

appModel.appType is unreliable #3181

Closed
Closed
@csells

Description

@csells

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions