Seeder class abstract
Base class for database seeders
Seeders allow you to populate your database with test data in a structured, reusable way.
class UserSeeder extends Seeder {
@override
Future<void> run(DataSource dataSource) async {
await User.create({'name': 'Test User', 'email': 'test@example.com'});
await User.create({'name': 'Jane Doe', 'email': 'jane@example.com'});
}
}
// In your test
await testDb.seed([UserSeeder(), PostSeeder()]);
Constructors
- Seeder()
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
run(
DataSource dataSource) → Future< void> - Run the seeder
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited