Skip to content

'Path.relativeLineTo' seems to not work when using '--wasm' flag. #157161

@T0PC4T

Description

@T0PC4T

Steps to reproduce

  1. Create a CustomPainter and a Path() object within the paint method.
  2. use 'relativeLineTo' to draw a shape.
  3. Run with wasm using: 'flutter run --wasm -d chrome'.

Expected results

I expected to see the shape.

Actual results

The shape does not appear when using the '--wasm' flag, but the shape does appear when running with JS.

Code sample

Code sample
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',
      home: const MyHomePage(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return CustomPaint(
      painter: MyPainter(),
      size: Size.infinite,
    );
  }
}

class MyPainter extends CustomPainter {
  @override
  void paint(Canvas canvas, Size size) {
    final path = Path();
    final center = size * 0.5;
    path.moveTo(center.width, center.height);
    path.lineTo(center.width + 50, center.height + 50);
    path.lineTo(center.width - 50, center.height + 50);
    path.lineTo(center.width, center.height);
    canvas.drawPath(path, Paint()..color = Colors.red);

    final relativePath = Path();
    relativePath.moveTo(center.width, center.height);
    relativePath.relativeLineTo(-50, -50);
    relativePath.relativeLineTo(100, 0);
    relativePath.relativeLineTo(-50, 50);
    canvas.drawPath(relativePath, Paint()..color = Colors.green);
  }

  @override
  bool shouldRepaint(MyPainter oldDelegate) => true;

  @override
  bool shouldRebuildSemantics(MyPainter oldDelegate) => true;
}

Screenshots or Video

Screenshots / Video demonstration

flutter run -d chrome
localhost_58656_

flutter run --wasm -d chrome
localhost_58509_

Logs

Logs
no errors

Flutter Doctor output

Doctor output
[√] Flutter (Channel master, 3.27.0-1.0.pre.98, on Microsoft Windows [Version 10.0.22631.4317], locale en-GB)
    • Flutter version 3.27.0-1.0.pre.98 on channel master at C:\Users\thoma\Documents\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 77f88ff78a (18 hours ago), 2024-10-17 22:43:20 +0300
    • Engine revision 31aaaaad86
    • Dart version 3.7.0 (build 3.7.0-34.0.dev)
    • DevTools version 2.40.1

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at C:\Users\thoma\AppData\Local\Android\sdk
    • Platform android-35, build-tools 33.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.0.5)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.0.32112.339
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2024.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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.11+0--11852314)

[√] VS Code (version 1.94.2)
    • VS Code at C:\Users\thoma\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.46.0

    • Platform android-35, build-tools 33.0.1
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.0.5)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.0.32112.339
    • Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2024.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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.11+0--11852314)

[√] VS Code (version 1.94.2)
    • VS Code at C:\Users\thoma\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.46.0


[√] Android Studio (version 2024.1)
    • Android Studio at C:\Program Files\Android\Android Studio
    • 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.11+0--11852314)

[√] VS Code (version 1.94.2)
    • VS Code at C:\Users\thoma\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.46.0


[√] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.4317]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 127.0.6533.100
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 129.0.2792.65

[√] Network resources
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.4317]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 127.0.6533.100
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 129.0.2792.65

[√] Network resources
[√] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work liste: wasmIssues related to the wasm build of Flutter Web.e: web_skwasmSkwasm rendering backend for webengineflutter/engine related. See also e: labels.found in release: 3.24Found to occur in 3.24found in release: 3.27Found to occur in 3.27has reproducible stepsThe issue has been confirmed reproducible and is ready to work onplatform-webWeb applications specificallyteam-webOwned by Web platform teamtriaged-webTriaged by Web platform team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions