init static method

dynamic init({
  1. required String version,
  2. required BuildContext context,
  3. required String baseURL,
})

Implementation

static init(
    {required String version,
    required BuildContext context,
    required String baseURL}) async {
  final response = await BemeliUpdateService.initializeService(baseURL);

  if (response != null) {
    final data = response.data[0];

    if (Platform.isAndroid && data.andriod && version != data.versioKey) {
      showDialog(
        context: context,
        builder: (context) => UpdateWidget(
          title: data.title,
          desc: data.desc,
          topImage: data.image,
          isForce: false,
          submitButton: data.submitButton,
          skipButton: data.ignoreButton,
          onSubmit: data.andriodClick,
        ),
      );
    } else if (Platform.isIOS && data.ios && version != data.versioKey) {
      showDialog(
        context: context,
        builder: (context) => UpdateWidget(
          title: data.title,
          desc: data.desc,
          topImage: data.image,
          isForce: data.forceUpdate,
          submitButton: data.submitButton,
          onSubmit: data.iosClick,
          skipButton: data.ignoreButton,
        ),
      );
    }
  }
}