'How to check tabController for null?
Can you please tell me how can I check tabController for null:
final CupertinoTabController? tabController = CupertinoTabController(initialIndex: 0);
Solution 1:[1]
A simple conditional check would do it for you
if (tabController != null) {
// code for tabController is not null
}
else {
// code for tabController is null
}
A ternary operator can be used too
(tabController != null) ? codeForNotNull : codeForNull
Reference: official docs
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |