Whenever I try to run flutter packages pub run build_runner watch
I get this error message in the Terminal
Failed to precompile build_runner:build_runner:
/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/dart_style-1.3.3/lib/src/dart_formatter.dart:105:30: Error: Too
many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
scanner.configureFeatures(featureSet);
^
pub finished with exit code 1
this happend after i update moor_flutter plugin from ^1.6.0 => ^ 3.0.0 There is no errors with the older plugin This is my code
import 'package:moor_flutter/moor_flutter.dart';
part 'Database.g.dart';
class Users extends Table {
IntColumn get id => integer().autoIncrement()();
TextColumn get name => text().withLength(min:1,max:50)();
TextColumn get mobile => text().withLength(min:1,max:25)();
DateTimeColumn get birthdate => dateTime()();
}
@UseMoor(tables : [Users ],daos:[UserDao])
class AppDatabase extends _$AppDatabase {
AppDatabase():super(FlutterQueryExecutor.inDatabaseFolder(path: 'db.sqlite',
logStatements: true));
@override
int get schemaVersion =>1;
}
@UseDao(tables:[Users ],)
class UserDao extends DatabaseAccessor<AppDatabase> with _$UserDaoMixin{
final AppDatabase db;
UserDao(this.db):super(db);
Future <List<User>> getAllUsers() => select(users).get();
Stream <List<User>> watchAllUsers() {
return (select(users)
..orderBy([
(p)=> OrderingTerm(expression:p.id,mode:OrderingMode.desc ),
// (p)=> OrderingTerm(expression:p.id,mode:Ordering.desc )
])
)
.watch();
}
Stream <List<User>> watchUsersByName(String txt) {
String qu="SELECT * FROM users where ";
for (int i = 0; i < txt.length-1; i++){
String c = txt[i];
qu=qu+"name like '%"+c+"%' and ";
}
qu=qu+"name like '%"+txt[txt.length-1]+"%' ORDER BY id DESC";
return customSelectStream(
qu,readsFrom: {users}
).map((rows){
return rows.map((row) => User.fromData(row.data,db)).toList();
});
}
Future insertUser(Insertable<User> user) => into(users).insert(user);
Future updateUser(Insertable<User> user) => update(users).replace(user);
Future deleteUser(Insertable<User> user) => delete(users).delete(user);
}
the vs code gives me errors in the Appdatabase constructor and customselectstream function but I searched the example in their Github repository and found the Appdatabase constructor is the same as mine. The problem still presists after I commented the watchusersbyname also I tried to remove the arguments from super in the Appdatabase constructor but nothing changed so can you please tell me what is the problem? Thanks in advance.
Here is the one command which you need to run and check for the solution
flutter pub upgrade
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With