I’m trying to generate a schema from a file with this content;
// file schemas.dart
import 'package:realm/realm.dart';
part 'schemas.g.dart';
@RealmModel()
class _Song {
late String? songNumber;
late String? fileName;
late String? englishTitle;
late String? year;
late String? key;
late String? author;
}
On running flutter pub run realm generate
I get the following error message.
flutter pub run realm generate
[INFO] Generating build script...
[INFO] Generating build script completed, took 429ms
[INFO] Precompiling build script......
[WARNING] /C:/<path>/flutter/.pub-cache/hosted/pub.dartlang.org/realm_generator-0.3.1+beta/lib/src/pseudo_type.dart:12:7: Error: The non-abstract class 'PseudoType' is missing implementations for these members:
- DartType.element2
Try to either
- provide an implementation,
- inherit an implementation from a superclass or mixin,
- mark the class as abstract, or
- provide a 'noSuchMethod' implementation.
class PseudoType extends TypeImpl {
^^^^^^^^^^
/C:/<path>/flutter/.pub-cache/hosted/pub.dartlang.org/analyzer-4.6.0/lib/dart/element/type.dart:52:16: Context: 'DartType.element2' is defined here.
Element? get element2;
^^^^^^^^
[INFO] Precompiling build script... completed, took 1.4s
[SEVERE] Failed to precompile build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.
What am I doing wrong?
I know the error message has suggestions on how to solve it. I’ve generated similar models in other projects successful.
I’m on Windows 11 x64, using Flutter 3.0.5 and Realm .0.3.1+beta