Skip to content

[RFW] Unable to use customizedErrorWidget.builder in RFW #144960

Closed

Description

@peixinli

Steps to reproduce

Override the error widget builder with ErrorWidget.builder.

Expected results

RFW should render the override error widget.

Actual results

RFW still renders the default error widget.

Code sample

Code sample
void main() {
  ErrorWidget.builder = (FlutterErrorDetails details) {
    // In release builds, show a yellow-on-blue message instead:
    return Container(
      alignment: Alignment.center,
      child: Text(
        'Error!\n${details.exception}',
        style: const TextStyle(color: Colors.yellow),
        textAlign: TextAlign.center,
        textDirection: TextDirection.ltr,
      ),
    );
  };
  runApp(const 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();

  static final RemoteWidgetLibrary _remoteWidgets = parseLibraryFile('''
    import core.widgets;
    widget root = Container(
      color: 0xFF002211,
      child: Center(
        child: Random(text: ["Hello, ", data.name.greet, "!"], textDirection: "ltr"),
      ),
    );
  ''');

  static const LibraryName coreName = LibraryName(<String>['core', 'widgets']);
  static const LibraryName mainName = LibraryName(<String>['main']);

  @override
  void initState() {
    super.initState();
    _runtime.update(coreName, createCoreWidgets());
    _runtime.update(mainName, _remoteWidgets);
    _data.update('greet', <String, Object>{'name': 'World'});
  }

  @override
  Widget build(BuildContext context) {
    return RemoteWidget(
      runtime: _runtime,
      data: _data,
      widget: const FullyQualifiedWidgetName(mainName, 'root'),
      onEvent: (String name, DynamicMap arguments) {
        debugPrint('user triggered event "$name" with data: $arguments');
      },
    );
  }
}

Screenshots or Video

Screenshots Screenshot 2024-03-11 at 2 45 42 PM

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
[Paste your output here]

Activity

  1. changed the title [-][RFW] Unable to used customized`ErrorWidget.builder` in RFW[/-] [+][RFW] Unable to use customized`ErrorWidget.builder` in RFW[/+] on Mar 11, 2024
  2. danagbemava-nc commented on Mar 12, 2024

    @danagbemava-nc
    Member

    Reproducible using the code sample provided above.

    flutter doctor -v
    [!] Flutter (Channel stable, 3.19.3, on macOS 14.3.1 23D60 darwin-arm64, locale en-GB)
        • Flutter version 3.19.3 on channel stable at /Users/nexus/dev/sdks/flutter
        ! Warning: `flutter` on your path resolves to /Users/nexus/dev/sdks/flutters/bin/flutter, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutter. Consider adding /Users/nexus/dev/sdks/flutter/bin to the front of your path.
        ! Warning: `dart` on your path resolves to /Users/nexus/dev/sdks/flutters/bin/dart, which is not inside your current Flutter SDK checkout at /Users/nexus/dev/sdks/flutter. Consider adding /Users/nexus/dev/sdks/flutter/bin to the front of your path.
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision ba39319843 (4 days ago), 2024-03-07 15:22:21 -0600
        • Engine revision 2e4ba9c6fb
        • Dart version 3.3.1
        • DevTools version 2.31.1
        • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and upgrades.
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
        • Android SDK at /Users/nexus/Library/Android/sdk
        • Platform android-34, build-tools 34.0.0
        • Java binary at: /Users/nexus/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 15.2)
        • Xcode at /Applications/Xcode-15.2.0.app/Contents/Developer
        • Build 15C500b
        • CocoaPods version 1.14.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2023.1)
        • Android Studio at /Users/nexus/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 17.0.7+0-17.0.7b1000.6-10550314)
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2023.2.5)
        • IntelliJ at /Users/nexus/Applications/IntelliJ IDEA Ultimate.app
        • Flutter plugin version 77.2.2
        • Dart plugin version 232.10286
    
    [✓] VS Code (version 1.87.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.84.0
    
    [✓] Connected device (5 available)
        • Pixel 7 (mobile)     • adb-28291FDH2001SA-5Lv71w._adb-tls-connect._tcp. • android-arm64  • Android 14 (API 34)
        • Nexus (mobile)       • 00008020-001875E83A38002E                        • ios            • iOS 17.3.1 21D61
        • Dean’s iPad (mobile) • 00008103-000825C811E3401E                        • ios            • iOS 17.3.1 21D61
        • macOS (desktop)      • macos                                            • darwin-arm64   • macOS 14.3.1 23D60 darwin-arm64
        • Chrome (web)         • chrome                                           • web-javascript • Google Chrome 122.0.6261.112
    
    [✓] Network resources
        • All expected network resources are available.
    
    ! Doctor found issues in 1 category.
    
    [✓] Flutter (Channel master, 3.21.0-4.0.pre.14, on macOS 14.3.1 23D60 darwin-arm64, locale en-GB)
        • Flutter version 3.21.0-4.0.pre.14 on channel master at /Users/nexus/dev/sdks/flutters
        • Upstream repository https://github.com/flutter/flutter.git
        • Framework revision 1ca88730a0 (7 hours ago), 2024-03-11 18:31:25 -0700
        • Engine revision 6745955bb4
        • Dart version 3.4.0 (build 3.4.0-220.0.dev)
        • DevTools version 2.33.1
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
        • Android SDK at /Users/nexus/Library/Android/sdk
        • Platform android-34, build-tools 34.0.0
        • Java binary at: /Users/nexus/Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 15.2)
        • Xcode at /Applications/Xcode-15.2.0.app/Contents/Developer
        • Build 15C500b
        • CocoaPods version 1.14.3
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 2023.1)
        • Android Studio at /Users/nexus/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 17.0.7+0-17.0.7b1000.6-10550314)
    
    [✓] IntelliJ IDEA Ultimate Edition (version 2023.2.5)
        • IntelliJ at /Users/nexus/Applications/IntelliJ IDEA Ultimate.app
        • Flutter plugin version 77.2.2
        • Dart plugin version 232.10286
    
    [✓] VS Code (version 1.87.0)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.84.0
    
    [✓] Connected device (6 available)
        • Pixel 7 (mobile)                • adb-28291FDH2001SA-5Lv71w._adb-tls-connect._tcp. • android-arm64  • Android 14 (API 34)
        • Nexus (mobile)                  • 00008020-001875E83A38002E                        • ios            • iOS 17.3.1 21D61
        • Dean’s iPad (mobile)            • 00008103-000825C811E3401E                        • ios            • iOS 17.3.1 21D61
        • macOS (desktop)                 • macos                                            • darwin-arm64   • macOS 14.3.1 23D60 darwin-arm64
        • Mac Designed for iPad (desktop) • mac-designed-for-ipad                            • darwin         • macOS 14.3.1 23D60 darwin-arm64
        • Chrome (web)                    • chrome                                           • web-javascript • Google Chrome 122.0.6261.112
    
    [✓] Network resources
        • All expected network resources are available.
    
    • No issues found!
    
  3. added
    packageflutter/packages repository. See also p: labels.
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    p: rfwRemote Flutter Widgets package
    and removed
    in triagePresently being triaged by the triage team
    on Mar 12, 2024
  4. ebwood commented on Mar 12, 2024

    @ebwood

    rfw directly build ErrorWidget when error occurs, not like flutter use ErrorWidget.builder.

  5. stuartmorgan-g commented on Mar 12, 2024

    @stuartmorgan-g
    Contributor

    /cc @Hixie

  6. added
    P2Important issues not at the top of the work list
    on Mar 12, 2024
  7. danagbemava-nc commented on Mar 14, 2024

    @danagbemava-nc
    Member

    Closing this since flutter/packages#6302 has been merged.

  8. github-actions commented on Mar 28, 2024

    @github-actions

    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 -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listfound in release: 3.20Found to occur in 3.20found in release: 3.21Found to occur in 3.21has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: rfwRemote Flutter Widgets packagepackageflutter/packages repository. See also p: labels.r: fixedIssue is closed as already fixed in a newer versionteam-ecosystemOwned by Ecosystem teamtriaged-ecosystemTriaged by Ecosystem team

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions