What's the difference between double.infinity and double.maxFinite in Dart?

Viewed 5767

What's the difference between double.infinity and double.maxFinite in Dart?

In Flutter, it looks like both do the same thing. When should I use each of them in Flutter?

1 Answers

The difference can be summarized into:

  • I want to be as big as my parent allows (double.infinity)

Some Widgets allow their children to be as big as they want to be

Column, ListView, OverflowBox In that situation use double.infinity

According to the documentation, these are the values assigned to the various double constants.

static const double infinity = 1.0 / 0.0;
static const double negativeInfinity = -infinity;
static const double minPositive = 5e-324;
static const double maxFinite = 1.7976931348623157e+308;

I hope this answers your question

Related