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

hashCode int
The hash code for this object.
no setterinherited
order int
Optional: Get the order in which this seeder should run Lower numbers run first. Default is 0.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

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