MOCKSTACKS
EN
Questions And Answers

More Tutorials









Flutter Other Performance Considerations


The purpose of this chapter is to be a ‘catch-all’ for anything else you should consider when building the most performant app possible.

Http Communication

Before we get into more Flutter performance topics, we should mention that most Flutter apps will be communicating with other computers. Such communication over a network is typically much slower than the highly-efficient Flutter user interface, so looking how your app communicates with other computers is a good place to start and can yield significant gains. What data are you getting from the server, do you really need all of it?

Are you using a JSON format? If so, what about making the JSON field names smaller to save on data size.
Can you make any requests to the server parallel and have them
Use Constants When Possible

Avoid Rebuilding Widgets

When using stateless widgets, avoid possible instantiation/rebuilds by using the const keyword (for example the Texts in the example below)

@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(title: new Text("Rows")),
body: new Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
const Text("the quick brown wolf"),
const Text("the quick brown wolf"),
const Text("the quick brown wolf")
],
)
],
));
}

Using Constants Saves Memory

For any given const value, a single const object will be created and reused no matter how many times the const expression(s) are evaluated.

getConst() => const [1, 2];
main() {
var a = getConst();
var b = getConst();
print(a === b); // true
}




Conclusion

In this page (written and validated by ) you learned about Flutter Other Performance Considerations . What's Next? If you are interested in completing Flutter tutorial, your next topic will be learning about: Flutter Publishing Your App.



Incorrect info or code snippet? We take very seriously the accuracy of the information provided on our website. We also make sure to test all snippets and examples provided for each section. If you find any incorrect information, please send us an email about the issue: mockstacks@gmail.com.


Share On:


Mockstacks was launched to help beginners learn programming languages; the site is optimized with no Ads as, Ads might slow down the performance. We also don't track any personal information; we also don't collect any kind of data unless the user provided us a corrected information. Almost all examples have been tested. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. By using Mockstacks.com, you agree to have read and accepted our terms of use, cookies and privacy policy.