You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
595 B
Dart

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());
}
}