import 'package:get_it/get_it.dart';
import './TelAndSmsService.dart';

GetIt locator = GetIt.instance;

bool locatorIsRegistered = false;

void setupLocator() {
  //解决登录后、退出登录、再次登录时，导致 TelAndSmsService 重复注册红屏报错问题
  //I/flutter ( 6555): The following ArgumentError was thrown building Builder:
  // I/flutter ( 6555): Invalid argument(s): Object/factory with  type TelAndSmsService is already registered inside GetIt.
  if (!locatorIsRegistered) {
    locatorIsRegistered = true;
    locator.registerSingleton(TelAndSmsService());
  }
}
