Service class

Marks a class as a factory service A new instance will be created on each request

Example:

@Service()
class EmailSender {
  void send(String to, String message) { /* ... */ }
}

With custom name:

@Service(name: 'smtp')
class SmtpEmailSender implements EmailSender { /* ... */ }

Constructors

Service({String? name, List<Type>? asType})
const

Properties

asType List<Type>?
Optional list of interfaces/abstract classes this service implements
final
hashCode int
The hash code for this object.
no setterinherited
name String?
Optional name for the service instance
final
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