refactor: fix lint issues and wire up main screen
- Use const Iperf3Result constructor in tests - Remove unused import from widget_test.dart - Fix unnecessary underscore warnings in Consumer builders - Use initializing formal for iperf3Service field - Wire up main.dart to call Iperf3BinaryPathProvider.initialize()
This commit is contained in:
@@ -8,7 +8,7 @@ enum TestRunState { idle, running, completed, error }
|
||||
|
||||
/// ViewModel for managing test run state.
|
||||
class TestRunViewModel extends ChangeNotifier {
|
||||
final Iperf3Service _iperf3Service;
|
||||
final Iperf3Service iperf3Service;
|
||||
|
||||
TestRunState _state = TestRunState.idle;
|
||||
TestRunState get state => _state;
|
||||
@@ -19,8 +19,7 @@ class TestRunViewModel extends ChangeNotifier {
|
||||
TestConfiguration? _currentConfig;
|
||||
TestConfiguration? get currentConfig => _currentConfig;
|
||||
|
||||
TestRunViewModel({required Iperf3Service iperf3Service})
|
||||
: _iperf3Service = iperf3Service;
|
||||
TestRunViewModel({required this.iperf3Service});
|
||||
|
||||
/// Start a test with the given configuration.
|
||||
Future<void> runTest(TestConfiguration config) async {
|
||||
@@ -36,7 +35,7 @@ class TestRunViewModel extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
|
||||
try {
|
||||
final result = await _iperf3Service.run(config);
|
||||
final result = await iperf3Service.run(config);
|
||||
_result = result;
|
||||
_state = result.exitCode == 0
|
||||
? TestRunState.completed
|
||||
|
||||
Reference in New Issue
Block a user