Repository navigation
Closed
flutter/packages
#11581Closed
Copy link
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: releaseChallenges faced when attempting to productionize an appChallenges faced when attempting to productionize an appa: typographyText rendering, possibly libtxtText rendering, possibly libtxtfound in release: 3.38Found to occur in 3.38Found to occur in 3.38found in release: 3.40Found to occur in 3.40Found to occur in 3.40has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesp: rfwRemote Flutter Widgets packageRemote Flutter Widgets packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Description
Steps to reproduce
- Create a Flutter RFW project with the provided code sample below
- Use RFW's
Textwidget withfontWeightproperty in the style parameter (e.g.,style: {fontWeight: "w700"}) - Run the app in debug mode - fontWeight appears correctly
- Build and run the app in release mode (flutter run --release or flutter build)
- Observe that the fontWeight is not applied to RFW Text widgets
Expected results
The fontWeight property of RFW Text widgets should be applied consistently in both debug and release modes, displaying the specified font weight (e.g., w700 appears bold, w400 appears normal).
Actual results
- Debug mode: fontWeight is applied correctly - text appears with the specified font weight
- Release mode: fontWeight is NOT applied - text appears with default font weight (w400) regardless of the specified value
Interestingly, when using a custom local widget (MText in the code sample) that manually handles fontWeight parsing, it works correctly in both debug and release modes. This suggests the issue is specific to RFW's built-in Text widget handling.
Code sample
Code sample
// Copyright 2013 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
/// For clarity, this example uses the text representation of the sample remote
/// widget library, and parses it locally. To do this, [parseLibraryFile] is
/// used. In production, this is strongly discouraged since it is 10x slower
/// than using [decodeLibraryBlob] to parse the binary version of the format.
import 'package:rfw/formats.dart' show parseLibraryFile;
import 'package:rfw/rfw.dart';
void main() {
runApp(const MaterialApp(home: Example()));
}
// The "#docregion" comment helps us keep this code in sync with the
// excerpt in the rfw package's README.md file.
//
// #docregion Example
class Example extends StatefulWidget {
const Example({super.key});
@override
State<Example> createState() => _ExampleState();
}
class _ExampleState extends State<Example> {
final Runtime _runtime = Runtime();
final DynamicContent _data = DynamicContent();
@override
void initState() {
super.initState();
_runtime.update(
const LibraryName(<String>['core', 'widgets']),
createCoreWidgets(),
);
_runtime.update(
const LibraryName(<String>['core', 'material']),
createMaterialWidgets(),
);
_update();
}
@override
void reassemble() {
// This function causes the Runtime to be updated any time the app is
// hot reloaded, so that changes to _createLocalWidgets can be seen
// during development. This function has no effect in production.
super.reassemble();
_update();
}
static WidgetLibrary _createLocalWidgets() {
return LocalWidgetLibrary(<String, LocalWidgetBuilder>{
'GreenBox': (BuildContext context, DataSource source) {
return ColoredBox(
color: const Color(0xFF002211),
child: source.child(<Object>['child']),
);
},
'Hello': (BuildContext context, DataSource source) {
return Center(
child: Text(
'Hello, ${source.v<String>(<Object>["name"])}!',
textDirection: TextDirection.ltr,
),
);
},
'MText': (BuildContext context, DataSource source) {
final String? fontWeightStr = source.v<String>(<Object>["fontWeight"]);
FontWeight fontWeight = FontWeight.w400;
if (fontWeightStr != null) {
switch (fontWeightStr) {
case "w100":
fontWeight = FontWeight.w100;
break;
case "w200":
fontWeight = FontWeight.w200;
break;
case "w300":
fontWeight = FontWeight.w300;
break;
case "w400":
fontWeight = FontWeight.w400;
break;
case "w500":
fontWeight = FontWeight.w500;
break;
case "w600":
fontWeight = FontWeight.w600;
break;
case "w700":
fontWeight = FontWeight.w700;
break;
case "w800":
fontWeight = FontWeight.w800;
break;
case "w900":
fontWeight = FontWeight.w900;
break;
}
}
return Text(
source.v<String>(<Object>["text"]) ?? '',
textAlign: TextAlign.center,
style: TextStyle(
fontSize: source.v<double>(<Object>["fontSize"]) ?? 12.0,
fontWeight: fontWeight),
);
},
});
}
static const LibraryName localName = LibraryName(<String>['local']);
static const LibraryName remoteName = LibraryName(<String>['remote']);
void _update() {
_runtime.update(localName, _createLocalWidgets());
// Normally we would obtain the remote widget library in binary form from a
// server, and decode it with [decodeLibraryBlob] rather than parsing the
// text version using [parseLibraryFile]. However, to make it easier to
// play with this sample, this uses the slower text format.
_runtime.update(
remoteName,
parseLibraryFile('''
import core.widgets;
import core.material;
import local;
widget root = Scaffold(
appBar: AppBar(title: Text(text: "Font Weight Demo")),
body: Center(
child: Column(
mainAxisAlignment: "center",
children: [
Text(text: '(RFW) This is a test of the font weight. w700', textAlign: "center", style: {fontSize: 12.0, fontWeight: "w700"}),
Text(text: '(RFW) This is a test of the font weight. w400', textAlign: "center", style: {fontSize: 12.0, fontWeight: "w400"}),
MText(text: '(Local) This is a test of the font weight. w700', fontSize: 12.0, fontWeight: "w700"),
MText(text: '(Local) This is a test of the font weight. w400', fontSize: 12.0, fontWeight: "w400"),
],
),
),
);
'''),
);
}
@override
Widget build(BuildContext context) {
return RemoteWidget(
runtime: _runtime,
data: _data,
widget: const FullyQualifiedWidgetName(remoteName, 'root'),
onEvent: (String name, DynamicMap arguments) {
debugPrint('user triggered event "$name" with data: $arguments');
},
);
}
}
// #enddocregion Example
Screenshots or Video
Screenshots / Video demonstration
Debug Mode (Working):
- The first two lines (RFW Text) show correct font weights
- The last two lines (Local MText) show correct font weights
- w700 appears bold, w400 appears normal
Release Mode (Not Working):
- The first two lines (RFW Text) show incorrect font weights - both appear as w400
- The last two lines (Local MText) show correct font weights
- Only the local widget respects the fontWeight specification
Logs
Logs
[Paste your logs here]Flutter Doctor output
Doctor output
[✓] Flutter (Channel stable, 3.35.7, on macOS 15.6 24G84 darwin-arm64, locale ko-KR) [179ms]
• Flutter version 3.35.7 on channel stable at /Users/unwmun/.asdf/installs/flutter/3.35.7-stable
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision adc9010625 (9 weeks ago), 2025-10-21 14:16:03 -0400
• Engine revision 035316565a
• Dart version 3.9.2
• DevTools version 2.48.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations,
enable-lldb-debugging
[✓] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [714ms]
• Android SDK at /Users/unwmun/Library/Android/sdk
• Emulator version 35.6.11.0 (build_id 13610412) (CL:N/A)
• Platform android-36, build-tools 36.0.0
• Java binary at: /Users/unwmun/.asdf/installs/java/openjdk-17.0.2/bin/java
This JDK is specified in your Flutter configuration.
To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
• Java version OpenJDK Runtime Environment (build 17.0.2+8-86)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 26.0.1) [553ms]
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 17A400
• CocoaPods version 1.16.2
[✓] Chrome - develop for the web [5ms]
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2024.3) [5ms]
• 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.6+-13368085-b895.109)
[✓] Network resources [386ms]
• All expected network resources are available.Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work lista: releaseChallenges faced when attempting to productionize an appChallenges faced when attempting to productionize an appa: typographyText rendering, possibly libtxtText rendering, possibly libtxtfound in release: 3.38Found to occur in 3.38Found to occur in 3.38found in release: 3.40Found to occur in 3.40Found to occur in 3.40has reproducible stepsThe issue has been confirmed reproducible and is ready to work onThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packagesmaterial_ui package in flutter/packagesp: rfwRemote Flutter Widgets packageRemote Flutter Widgets packagepackageflutter/packages repository. See also p: labels.flutter/packages repository. See also p: labels.team-designOwned by Design Languages teamOwned by Design Languages teamtriaged-designTriaged by Design Languages teamTriaged by Design Languages team
Activity
tirth-patel-nc commentedon Dec 30, 2025
Thanks for the report. Seeing the same behaviour with latest SDK versions.
3 remaining items
[rfw] Fix fontWeight not applied in release mode
[rfw] Fix fontWeight not applied in release mode
[rfw] Fix fontWeight not applied in release mode
[rfw] Fix fontWeight not applied in release mode
[rfw] Fix fontWeight not applied in release mode
[rfw] Fix fontWeight not applied in release mode
[rfw] Fix fontWeight not applied in release mode (flutter#11581)
github-actions commentedon Oct 1, 2026
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.