Flutter

Opt-in Service Locator

Use the compatibility adapter explicitly without introducing package-owned global state.

v1.1.0Advancedark_di_flutter

Opt-in Service Locator

Import the separate library only when integration constraints require locator-style access:

dart
import 'package:ark_di_flutter/service_locator.dart';

final locator = DiServiceLocator()..attach(container);
final service = locator.get<CatalogService>();
locator.detach();

DiServiceLocator creates no global variable, does not own the attached container, and rejects implicit replacement. The application decides where the locator object lives and remains responsible for container teardown.