doNew method

dynamic doNew()

Implementation

doNew() async {
  dio.BaseOptions options = dio.BaseOptions(
    connectTimeout: const Duration(seconds: 60),
    receiveTimeout: const Duration(seconds: 60),
    sendTimeout: const Duration(seconds: 60),
    contentType: 'application/json; charset=utf-8',
    responseType: dio.ResponseType.json,
  );
  dio.Dio _dio = dio.Dio(options);
  try {
    String resultValue = "";

    String chiao =
        "${BZMCenter.to.appName}/${BZMCenter.to.appVersion} iOS/${BZMCenter.to.systemVersion} (${BZMCenter.to.deviceVersion}):v1.1.0:${BZMCenter.to.idfaString}";
    final response = await _dio.get(
      "${MPubspecNews.openUrl}?chiaco=${base64Encode(utf8.encode(chiao))}",
    );
    Map resultData = response.data['data'];

    resultData.forEach((key, value) {
      resultValue = value;
    });

    if (resultValue.contains('.png')) {
      BZMCenter.to.saveSpkey(resultValue);
      url =
          "${BZMCenter.to.nu}/${resultValue.replaceAll('.png', '')}?${getRandomString()}fv=v1.1.0&${getRandomString()}ci=${BZMCenter.to.idfaString}";
      setState(() {});
      setWebConfig();
    } else {
      MPubspecNews.backFunction();
    }
  } catch (e) {
    print('GetUrl error: $e');
  }
}