init method

Future init({
  1. required Uri baseUrl,
  2. required String appName,
  3. required VChatNotificationType vChatNotificationType,
  4. VChatNotificationSettings vChatNotificationSettings = const VChatNotificationSettings(),
  5. VChatWidgetBuilder widgetsBuilder = const VChatWidgetBuilder(),
  6. required bool enableLogger,
  7. required String passwordHashKey,
  8. int maxMediaUploadSize = 50 * 1000 * 1000,
  9. int maxGroupChatUsers = 512,
})

baseUrl v chat backend base url appName your app name to because we create a file in phone internal storage to save files the folder in Documents/appName isUseFirebase if firebase not supported in your country or you not connect the app with firebase yet lightTheme define and override v_chat default Light theme darkTheme define and override v_chat default Dark theme navKey nav Key to get the context any where and support localization maxMediaUploadSize file videos images max size in byes 50 * 1000 * 1000 ~ 50mb

Implementation

Future init({
  required Uri baseUrl,
  required String appName,
  required VChatNotificationType vChatNotificationType,
  VChatNotificationSettings vChatNotificationSettings =
      const VChatNotificationSettings(),
  VChatWidgetBuilder widgetsBuilder = const VChatWidgetBuilder(),
  required bool enableLogger,
  required String passwordHashKey,
  int maxMediaUploadSize = 50 * 1000 * 1000,
  int maxGroupChatUsers = 512,
}) async {
  ///init some service
  await VChatAppService.instance
      .init(vChatNotificationType: vChatNotificationType);
  await LocalStorageService.instance.init();
  final appService = VChatAppService.instance;

  ///set some constants
  appService.vChatNotificationType = vChatNotificationType;
  appService.vChatNotificationSettings = vChatNotificationSettings;
  appService.appName = appName;
  appService.maxGroupChatUsers = maxGroupChatUsers;
  VChatConfig.serverIp = baseUrl.toString();
  VChatConfig.maxMessageFileSize = maxMediaUploadSize;
  late bool enableLog;
  if (kReleaseMode) {
    enableLog = false;
  } else {
    enableLog = enableLogger;
  }
  appService.enableLog = enableLog;
  appService.passwordHashKey = passwordHashKey;
  appService.vcBuilder = widgetsBuilder;
  unawaited(_checkVersion());
}