Skip to content

web hot reload fails to reload changes to mixins and class properties #61864

@drrnbrns

Description

@drrnbrns

Steps to reproduce

  1. Create a sample app with flutter create --platforms=web sample
  2. Create the source files and update main.dart as per code sample below
  3. Debug the app in VSCode
  4. Modify the sample class and sample mixin with changes

Observed::

  • Changes to the returned value from fromMixin are not reflected in the app, unless you later save the sample_class.dart file too
  • Changes to fromClass work as expected
  • Changes to the properties messageClass and messageMixin are never reflected.

Code sample

Create lib\sample_mixin.dart:

mixin SampleMixin {
  String messageMixin = "SampleMixin";

  String fromMixin() {
    return "From mixin";
  }
}

Create lib\sample_class.dart

import 'sample_mixin.dart';

class SampleClass with SampleMixin {
  String messageClass = "SampleClass";

  String fromClass() {
    return "From class";
  }
}

Replace all of main.dart with the following:

import 'package:flutter/material.dart';
import 'sample_class.dart';

void main() {
  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const MyHomePage(),
    );
  }
}

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

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

class _MyHomePageState extends State<MyHomePage> {
  final messages = SampleClass();


  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text("Class method: ${messages.fromClass()}"),
            Text("Mixin method: ${messages.fromMixin()}"),
            Text("Class property: ${messages.messageClass}"),
            Text("Mixin property: ${messages.messageMixin}"),
          ],
        ),
      ),
    );
  }
}

Flutter version

Flutter 3.35.7 • channel stable • https://github.com/flutter/flutter.git
Framework • revision adc9010625 (8 days ago) • 2025-10-21 14:16:03 -0400
Engine • hash 6b24e1b529bc46df7ff397667502719a2a8b6b72 (revision 035316565a) (8 days ago) • 2025-10-21 14:28:01.000Z
Tools • Dart 3.9.2 • DevTools 2.48.0

Metadata

Metadata

Assignees

Labels

P2A bug or feature request we're likely to work onarea-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.front-end-serverIssues with the frontend serverweb-dev-compilerweb-hot-reloadIssues related to stateful hot reload on the web

Type

No type

Projects

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions