1
0
Fork 0
flutter_demo_energy/lib/models/energy_model.dart

43 lines
1.0 KiB
Dart

import 'package:energy/algorithms/energy.dart';
import 'package:energy/algorithms/heat_capacity.dart';
import 'package:flutter/material.dart';
class EnergyModel with ChangeNotifier {
double _mass = 0.0; // in kg
double _hStart = 0.0; // in m
double _hEnd = 0.0;
double _vStart = 0.0; // in m/s
double _vEnd = 0.0;
double get mass => _mass;
double get hStart => _hStart;
double get hEnd => _hEnd;
double get vStart => _vStart;
double get vEnd => _vEnd;
set mass(double mass) {
_mass = mass;
notifyListeners();
}
set hStart(double height) {
_hStart = height;
notifyListeners();
}
set hEnd(double height) {
_hEnd = height;
notifyListeners();
}
set vStart(double velocity) {
_vStart = velocity;
notifyListeners();
}
set vEnd(double height) {
_vEnd = height;
notifyListeners();
}
get energy => freedEnergy(_mass, _hStart, _hEnd, _vStart, _vEnd);
get water => literWaterThatCanBeBoiled(energy);
get iron => kgIronThatCanBeHeatetUntilRed(energy);
}