initUIKit method
Implementation
Future<void> initUIKit(String apikey, String region) async {
ChangeNotifierProvider(create: (context) => ChannelVM());
ChangeNotifierProvider(create: (context) => UserVM());
ChangeNotifierProvider(create: (context) => AmityVM());
ChangeNotifierProvider(create: (context) => ImagePickerVM());
env = ENV(apikey, region);
AmityRegionalHttpEndpoint? amityEndpoint;
if (region.isNotEmpty) {
switch (region) {
case "":
{
log("REGION is not specify Please check .env file");
}
;
break;
case "sg":
{
amityEndpoint = AmityRegionalHttpEndpoint.SG;
}
;
break;
case "us":
{
amityEndpoint = AmityRegionalHttpEndpoint.US;
}
;
break;
case "eu":
{
amityEndpoint = AmityRegionalHttpEndpoint.EU;
}
;
}
} else {
throw "REGION is not specify Please check .env file";
}
await AmityCoreClient.setup(
option:
AmityCoreClientOption(apiKey: apikey, httpEndpoint: amityEndpoint!),
sycInitialization: true);
}