Unable to create an Item class - The name 'ItemCopyWith' is defined in the libraries...
Opened this issue · 3 comments
Not sure if this is really a problem or its just a namespace we can't use (happy if that's the case).
When I create an Item MappableClass
@MappableClass()
class Item with ItemMappable {
...
}
and then use it
@MappableClass()
class OtherClass with OtherClassMappable {
List<Item> items;
OtherClass(this.items);
}
the mapper file created for OtherClass has the error:
The name 'ItemCopyWith' is defined in the libraries 'package:dart_mappable/src/copy_with/list_copy_with.dart' and 'package:my/package/item.dart'
Is it possible to rename the internals to make it less likely to have this clash (and possibly others?) or should I just rename my class and treat it as a keyword?
Thanks :)
I will not be able to rename this since it would be a major braking change for all users.
You can try giving the import of Item a prefix, I think the builder would respect prefixes (I think ... its been a long time since I wrote this code 😅)
If that doesn't work you would have to rename the Item class
Ah ok I hoped it might just be something used internally, nevermind :) Thanks for the rapid reply :)
You could also maybe hide it from the dart_mappble import