Repository class

Marks a class as a bean that stores and loads data.

It does exactly what Component does; the name tells the reader that the class is the data-access layer. Spring also translates database exceptions for such beans; this package does not.

@Repository()
class OrderRepository {
  final _orders = <int, Order>{};
  Order? findById(int id) => _orders[id];
}

Spring (Java):

@Repository
class OrderRepository {
  Order findById(int id) { ... }
}
Inheritance

Constructors

Repository([String? name])
Declares the bean; name replaces the default bean name.
const

Properties

hashCode → int
The hash code for this object.
no setterinherited
name → String?
The bean name; null gives the class name in lowerCamelCase.
finalinherited
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
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited