• Latest
  • Hot
  • Ask
  • Full Apps
  • Ui
  • Packages
Ask February 06,2022

save and reuse computed data in widget build: flutter

The question is how to prevent calls that compute data in build.

Example (a simplistic one)

for (var map in something)
...
child: Row(
  children: [
    Text(getActualDate(map['days'])),
    Text(getActualDate(map['days']))
  ],
),
...

Here the getActualDate function has been called and the result available. How can I save and reuse that result and not call getActualDate again?


Solution 1: BJW

By using state management, like provider


Twitter Facebook Reddit Hacker News LinkedIn Email

Most Viewed

Netflix UI Clone Build with Flutter and BloC

GitJournal - Markdown Notes Build with Fluter

How to debug multiple widgets used the same GlobalKey

Sign in up takes so long time to load from firebase

Featured Articles

Catagories

  • Ask63292
  • Full Apps40
  • Ui5
  • Packages2
  • Game2
  • Template0
  • flutter
  • android-studio
  • intellij-idea
  • flutter-layout
  • dart-analyzer
  • mvvm
  • state-management
  • flutter-state
  • visual-studio-code
  • android-emulator
  • json
  • dart
  • json-serializable
  • slider
  • cookies
  • flutter-inappwebview
  • flutter-provider
  • android
  • gradle
  • android-gradle-plugin
  • build.gradle
  • runtime-error
  • uri
  • string-parsing
  • database
  • sqlite
  • android-sqlite
  • ios
  • bloc
  • firebase
  • google-cloud-firestore
  • regex
  • fl-chart
  • google-play
  • imagepicker
  • api
  • model
  • switch-statement
  • themes
  • azure-devops
  • azure-pipelines
  • ipa
  • memory
  • stream
  • infinite-scroll
  • firebase-realtime-database
  • firebase-authentication
  • authentication
  • webview
  • oauth
  • list
  • navigation
  • bash
  • terminal
  • flutter-widget
  • java
  • routes
  • drawer
  • async-await
  • containers
  • Privacy Policy
  • Submit Project
© Copyright © All rights reserved
Licensed under cc by-sa 3.0 with attribution required.

Catagories

  • Ask
  • Full Apps
  • Ui
  • Packages

Join our Newsletter