I have a BMI calculator and i want to use it in my other dart file which is a result screen.
This is my calculator :
calculatePressed() {
var tall = _currentValue1.toString();
var weight = _currentValue2.toString();
var cTall = int.parse(tall);
var dWeight = int.parse(weight);
var dTall = cTall / 100;
var bmi = (dWeight / dTall * dTall).toInt();
var result = 'Your Bmi is nn $bmi';
print(bmi);
}
I want to use it in a Text widget.
How should i do that?
2
Answers
You can use this approach
main.dart
utils.dart
This is what you could do in Flutter.
main.dart
home_page.dart
utils.dart