text stringlengths 1 372 |
|---|
// state of the future. by looking if the snapshot contains |
// an error or if the data is null, you can decide what to |
// show to the user. |
if (snapshot.hasdata) { |
return center( |
child: text( |
snapshot.data.toString(), |
), |
); |
} else { |
return const center( |
child: CupertinoActivityIndicator(), |
); |
} |
}, |
), |
); |
} |
} |
<code_end> |
for the complete example, check out the |
async_weather file on GitHub. |
<topic_end> |
<topic_start> |
leveraging a background thread/isolate |
flutter apps can run on a variety of multi-core hardware, |
including devices running macOS and iOS. |
to improve the performance of these applications, |
you must sometimes run tasks on different cores |
concurrently. this is especially important |
to avoid blocking UI rendering with long-running operations. |
in swift, you can leverage GCD to run tasks on global queues |
with different quality of service class (qos) properties. |
this indicates the task’s priority. |
in dart, you can offload computation to a worker isolate, |
often called a background worker. |
a common scenario spawns a simple worker isolate and |
returns the results in a message when the worker exits. |
as of dart 2.19, you can use isolate.run() to |
spawn an isolate and run computations: |
in flutter, you can also use the compute function |
to spin up an isolate to run a callback function: |
in this case, the callback function is a top-level |
function as shown below: |
you can find more information on dart at |
learning dart as a swift developer, |
and more information on flutter at |
flutter for SwiftUI developers or |
flutter for UIKit developers. |
<topic_end> |
<topic_start> |
upgrading flutter |
no matter which one of the flutter release channels |
you follow, you can use the flutter command to upgrade your |
flutter SDK or the packages that your app depends on. |
<topic_end> |
<topic_start> |
upgrading the flutter SDK |
to update the flutter SDK use the flutter upgrade command: |
this command gets the most recent version of the flutter SDK |
that’s available on your current flutter channel. |
if you are using the stable channel |
and want an even more recent version of the flutter SDK, |
switch to the beta channel using flutter channel beta, |
and then run flutter upgrade. |
<topic_end> |
<topic_start> |
keeping informed |
we publish migration guides for known breaking changes. |
we send announcements regarding these changes to the |
flutter announcements mailing list. |
to avoid being broken by future versions of flutter, |
consider submitting your tests to our test registry. |
<topic_end> |
<topic_start> |
switching flutter channels |
flutter has two release channels: |
stable and beta. |
<topic_end> |
<topic_start> |
the stable channel |
we recommend the stable channel for new users |
and for production app releases. |
the team updates this channel about every three months. |
the channel might receive occasional hot fixes |
for high-severity or high-impact issues. |
the continuous integration for the flutter team’s plugins and packages |
includes testing against the latest stable release. |
the latest documentation for the stable branch |
is at: https://api.flutter.dev |
<topic_end> |
<topic_start> |
the beta channel |
the beta channel has the latest stable release. |
this is the most recent version of flutter that we have heavily tested. |
this channel has passed all our public testing, |
has been verified against test suites for google products that use flutter, |
and has been vetted against contributed private test suites. |
the beta channel receives regular hot fixes |
to address newly discovered important issues. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.