Untitled

 avatar
unknown
dart
3 years ago
1.5 kB
2
Indexable
WebServices.socket.on("CustomerRequest", (data) async {
      isTabletConfirmed = false;
      var result = jsonDecode(data);

      JobInfoModel _jobInfoModel = JobInfoModel.fromJson(result);
      if (!mounted) return;

      if (polylines != null) {
        polylines.clear();
      }

      print(data);

      _originLatitude = _jobInfoModel.data.requestInfo.beginLat;
      _originLongitude = _jobInfoModel.data.requestInfo.beginLng;
      _destLatitude = _jobInfoModel.data.requestInfo.endLat;
      _destLongitude = _jobInfoModel.data.requestInfo.endLng;

      if (_originLatitude != null && _originLongitude != null) {
        markers.clear();
        if (_destLatitude != null && _destLongitude != null) {
          toCustomer = false;
          await startMarkerCreator().then((v) async {
            await destinationMarkerCreator().then((v) async {
              await getpolylines(_originLatitude, _originLongitude,
                      _destLatitude, _destLongitude)
                  .then((v) async {
                await getAddress(true).then((v) {
                  setState(() {
                    isJobAvailable = true;
                  });
                });
              });
            });
          });
        } else {
          await startMarkerCreator().then((v) async {
            await getAddress(false).then((v) {
              setState(() {
                isJobAvailable = true;
              });
            });
          });
        }
      }
    });
Editor is loading...