Singleton class

A macro that transforms a class into a singleton.

This macro will:

  1. Add a private constructor.
  2. Add a static instance getter.

Example usage:

@Singleton
class MyService {
  // Your implementation
}

This allows for easy access to a single instance of the class throughout the application.

Constructors

Singleton.new()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

buildDeclarationsForClass(ClassDeclaration clazz, MemberDeclarationBuilder builder) FutureOr<void>
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