createModelFile method

Future<void> createModelFile()

Implementation

Future<void> createModelFile() async {
  // set up model file
  var data = await _setupRequestData();

  if (data[0]) {
    print(
        "Thunder is creating your model file . please wait for seconds 🔃\n\n\n");
    BaseClient.safeApiCall(
      data[1]["url"].trim(),
      data[1]["type"],
      headers: data[1]["headers"],
      data: data[1]["body"],
      queryParameters: data[1]["params"],
      onSuccess: (res) {
        if (res.data is Map || res.data is List) {
          CreateModels()._createModel(
            name: data[1]["name"],
            data: res.data,
          );
        } else {
          print("Thunder can convert only Map or List !!");
        }
      },
    );
  }
}