When do we use double.INFINITY ?
When do we use double.INFINITY ?
Here is a concise answer to your interview question about when to use double.INFINITY in Flutter:
double.INFINITY in FlutterIn Flutter, double.INFINITY is a constant that represents positive infinity. It is useful in a few specific scenarios:
When creating constraints for a widget, such as with BoxConstraints, you can use double.INFINITY to indicate that the constraint has no limit in a particular dimension. For example:
BoxConstraints(
minWidth: 100,
maxWidth: double.INFINITY,
minHeight: 50,
maxHeight: double.INFINITY,
)
This sets a minimum width of 100 and a minimum height of 50, but allows the widget to expand infinitely in width and height.
Đăng nhập để tham gia thảo luận cùng mọi người.
Chưa có bình luận nào
Hãy là người đầu tiên chia sẻ suy nghĩ của bạn.