drift icon indicating copy to clipboard operation
drift copied to clipboard

moor file warning: Must be an interface type (backed by a class)

Open SteveAlexander opened this issue 3 years ago • 2 comments

moor 4.4.1 moor_generator 4.4.1

In VS Code, I'm getting a warning:

Must be an interface type (backed by a class) dart(moor.errorGeneric)

Here's an example part of the moor file:

image

The UriConverter classs looks like this:

class UriConverter extends TypeConverter<Uri, String> {
  const UriConverter();
  @override
  Uri? mapToDart(String? fromDb) {
    if (fromDb == null) {
      return null;
    }
    return Uri.parse(fromDb);
  }

  @override
  String? mapToSql(Uri? value) {
    if (value == null) {
      return null;
    }
    return value.toString();
  }
}

SteveAlexander avatar Jul 13 '21 12:07 SteveAlexander

I see, I think this is because we don't properly support resolving Dart expressions in the plugin yet. I'll take a look at how that might be done.

simolus3 avatar Jul 13 '21 13:07 simolus3

I've fixed this in 230a18abdc1fa3eda461a7093f8f33fb62547440, but I still need to investigate a potential performance impact of that approach.

simolus3 avatar Jul 13 '21 19:07 simolus3