init static method

void init()

Inicializa a marca a partir do dart-define CLIENT.

Implementation

static void init() {
  const clientSlug = String.fromEnvironment('CLIENT', defaultValue: '');
  _rawClientSlug = clientSlug;

  if (clientSlug.isEmpty) {
    developer.log(
      'AppBrand: dart-define CLIENT nao definido, usando fallback "${_fallback.clientSlug}"',
      name: 'AppBrand',
    );
    _current = _fallback;
    return;
  }

  final brand = _brands[clientSlug];
  if (brand == null) {
    developer.log(
      'AppBrand: cliente "$clientSlug" nao registrado em _brands. '
      'Disponiveis: ${_brands.keys.join(", ")}. Usando fallback "${_fallback.clientSlug}"',
      name: 'AppBrand',
      level: 900, // warning
    );
    _current = _fallback;
    return;
  }

  _current = brand;
  developer.log(
    'AppBrand: inicializado com cliente "${brand.clientSlug}"',
    name: 'AppBrand',
  );
}