Skip to content

Fix UnimplementedError() by using double instead of int as fallback#1

Open
felixwoestmann wants to merge 2 commits intosameersingh2704:mainfrom
felixwoestmann:main
Open

Fix UnimplementedError() by using double instead of int as fallback#1
felixwoestmann wants to merge 2 commits intosameersingh2704:mainfrom
felixwoestmann:main

Conversation

@felixwoestmann
Copy link

This PR makes translate use double instead of int as fallback values. The reason being that when the fallback is used, the underlying function will throw an UnimplementedError(). This can happen when executing WidgetTests.


  void translate(dynamic x, [double y = 0.0, double z = 0.0]) {
    double tx;
    double ty;
    double tz;
    final tw = x is Vector4 ? x.w : 1.0;
    if (x is Vector3) {
      tx = x.x;
      ty = x.y;
      tz = x.z;
    } else if (x is Vector4) {
      tx = x.x;
      ty = x.y;
      tz = x.z;
    } else if (x is double) {
      tx = x;
      ty = y;
      tz = z;
    } else {
      throw UnimplementedError();
    }

@felixwoestmann felixwoestmann changed the title Use double instead of int as fallback Fix UnimplementedError() by using double instead of int as fallback Nov 30, 2023
@t-unit
Copy link

t-unit commented Jun 10, 2024

@sameersingh2704 any chance we can get this merged and published on pub.dev?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants