dart_mappable icon indicating copy to clipboard operation
dart_mappable copied to clipboard

incorrect path in "part of" when generating into a subfolder

Open brash-ram opened this issue 1 year ago • 4 comments

I specified build_extensions as in the example https://pub.dev/documentation/dart_mappable/latest/topics/Configuration-topic.html.

In all generated classes, the path for "part of" was generated with an incorrect path.

Generated code example:

part of '..\my_class.dart';

Correct path:

part of '../my_class.dart';

How can I solve this problem? I updated the library to the latest 4.2.2 version and it didn't help. I work on Windows.

brash-ram avatar May 13 '24 09:05 brash-ram

Man I though by now I fixed all the path issues on windows. Will look into it.

schultek avatar Jun 30 '24 20:06 schultek

Facing the same issue, @schultek is a fix coming anytime soon? @brash-ram did you find a way around it?

mateen-demah avatar Aug 31 '24 17:08 mateen-demah

I have found an additional issue here. On my system, backslashes are fine as part of a path but using them comes with an unexpected consequence.

One of my mappable classes starts with the letter u.

When you place \u next to each other, Dart sees that as a Unicode escape sequence, causing the build to fail.

[SEVERE] dart_mappable_builder on lib/model/user_details.dart:

Could not format because the source could not be parsed:

line 7, column 12 of .: An escape sequence starting with '\u' must be followed by 4 hexadecimal digits.
  ╷
7 │ part of '..\user_details.dart';
  │            ^^
  ╵

The-Funk avatar Sep 07 '24 17:09 The-Funk

@schultek do you know if build_runner can be configured to use only package based imports and not relative imports?

The-Funk avatar Sep 07 '24 17:09 The-Funk