Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After converting to Hasmany previous value pops up. #249

Open
mahinikaras opened this issue Oct 16, 2023 · 2 comments
Open

After converting to Hasmany previous value pops up. #249

mahinikaras opened this issue Oct 16, 2023 · 2 comments

Comments

@mahinikaras
Copy link

mahinikaras commented Oct 16, 2023

`final salesAnalysisesList = evidence.salesAnalysises?.map((analysis) {

    return SalesAnalysises(
      id: analysis.id,
      landSqm: analysis.landSqm,
      landRate: analysis.landRate,
      landTotalValue: analysis.landTotalValue,
      mainBuildingSqm: analysis.mainBuildingSqm,
      mainBuildingRate: analysis.mainBuildingRate,
      mainBuildingTotalValue: analysis.mainBuildingTotalValue,
      actualWeeklyRent: analysis.actualWeeklyRent,
      actualAnnualRent: analysis.actualAnnualRent,
      actualYield: analysis.actualYield,
      estimatedWeeklyRent: analysis.estimatedWeeklyRent,
      estimatedAnnualRent: analysis.estimatedAnnualRent,
      estimatedYield: analysis.estimatedYield,
      ancillaryImprovementTotalValue: analysis.ancillaryImprovementTotalValue,
      isAncillaryImprovement: analysis.isAncillaryImprovement,
      displayName: analysis.displayName,
      isLandUsingSqm: analysis.isLandUsingSqm,
      salesEvidenceId: analysis.salesEvidenceId,
    );
  }).toList();
  print("salesAnalysises rate 1:${salesAnalysisesList!.first.salesEvidenceId} ${salesAnalysisesList!.first.landRate}");
  var a = SalesEvidences(
    id: evidence.id,
    captureNumber: evidence.captureNumber,
    address: evidence.address,
    comments: evidence.comments,
    comparison: evidence.comparison,
    price: evidence.price,
    saleDate: evidence.saleDate,
    valuationId: evidence.valuationId,
    salesId: evidence.salesId,
    analysedRate: evidence.analysedRate,
    reOrder: evidence.reOrder,
    coreLogicId: evidence.coreLogicId,
    salesAnalysises: HasMany(salesAnalysisesList?.toSet()),
    ancillaryImprovements: HasMany(ancillaryImprovementsList?.toSet()),
  );
  print("salesAnalysises rate 2:${a.salesAnalysises!.first.salesEvidenceId} ${a.salesAnalysises!.first.landRate}");`

After converting to Hasmany the updated salesAnalysisesList automatically changed to the previous value. Can you please tell me how can I solve it?

@fahimShahriaar
Copy link

fahimShahriaar commented Oct 22, 2023

@frank06 could you please comment on this issue? I'm facing the same problem also.
var x = HasMany(myList?.toSet());
When I execute this line, x is not updated with the myList new values. x becomes myList previous value.
Note: The above code runs fine when I use Flutter v3.7.12 and flutter_data v1.3.4. After upgrading my project to Flutter 3.13.6. And flutter_data 1.5.9 the above issue occurs.

@frank06
Copy link
Contributor

frank06 commented Dec 27, 2023

Sorry for the long delay. I will have a look at this. If you have any updates please let me know

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants