Service class

Marks a class as a bean that holds business logic.

It does exactly what Component does. The different name tells the reader which layer the class belongs to, and it can be used in scan filters and pointcuts.

// The repository bean is injected through the constructor.
@Service()
class OrderService {
  OrderService(this.repository);
  final OrderRepository repository;
}

Spring (Java):

@Service
class OrderService {
  OrderService(OrderRepository repository) { ... }
}
Inheritance

Constructors

Service([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