Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pubspec versions pinning #75

Merged
merged 4 commits into from
Mar 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@ dependencies:
hmi_core:
git:
url: https://github.com/a-givertzman/hmi_core.git
ref: master
ref: 1.0.0
hmi_networking:
git:
url: https://github.com/a-givertzman/hmi_networking.git
ref: master
fl_chart:
git:
url: https://github.com/a-givertzman/fl_chart.git
ref: master
ref: 1.0.0
another_flushbar: ^1.12.29

dev_dependencies:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';

Check notice on line 1 in lib/src/charts/crane_load_chart/crane_load_chart_legend_json.dart

View workflow job for this annotation

GitHub Actions / coverage

Good coverage level

96.29%
import 'package:hmi_core/hmi_core.dart';
import 'package:hmi_core/src/core/result_new/result.dart';
///
class CraneLoadChartLegendJson {
final JsonList<Map<String, dynamic>> _jsonList;
Expand All @@ -11,6 +12,12 @@
///
Future<Map<String, List<List<dynamic>>>> get decoded {
return _jsonList.decoded
.then((result) {
return switch(result) {
Ok(:final value) => value,
Err(:final error) => throw error,
};
})
.then(
(list) => list.fold<Map<String, List<List<dynamic>>>>(
{
Expand Down
7 changes: 7 additions & 0 deletions lib/src/charts/crane_load_chart/swl_data.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:hmi_core/hmi_core.dart';

Check notice on line 1 in lib/src/charts/crane_load_chart/swl_data.dart

View workflow job for this annotation

GitHub Actions / coverage

Good coverage level

79.16%
import 'package:hmi_core/hmi_core_result_new.dart';
///
class SwlData {
static final _log = const Log('SwlData')..level = LogLevel.debug;
Expand Down Expand Up @@ -34,6 +35,12 @@
///
Future<List<double>> _loadAsset(TextFile textFile) {
return textFile.content
.then((result) {
return switch(result) {
Ok(:final value) => value,
Err(:final error) => throw error,
};
})
.then((value) {
final doubleList = _parseStringList(
value.replaceAll('\n', ';').replaceAll(',', '.').trim().split(';'),
Expand Down
7 changes: 7 additions & 0 deletions lib/src/edit_field/network_dropdown_field/oil_data.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:hmi_core/hmi_core.dart';

Check notice on line 1 in lib/src/edit_field/network_dropdown_field/oil_data.dart

View workflow job for this annotation

GitHub Actions / coverage

Good coverage level

80.00%
import 'package:hmi_core/hmi_core_result_new.dart';
///
/// Reads oil names and spec data for [SettingsPage] - HPU
/// from assets json file
Expand All @@ -16,6 +17,12 @@
Future<List<String>> names() async {
if (_data.isEmpty) {
await _jsonMap.decoded
.then((result) {
return switch(result) {
Ok(:final value) => value,
Err(:final error) => throw error,
};
})
.then((value) => _data.addAll(value))
.onError((error, stackTrace) {
throw Failure.unexpected(
Expand Down
8 changes: 4 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: hmi_widgets
description: A Flutter package helps to visualize states, values, changes and other artefacts from technological processes.
version: 0.0.1
version: 1.0.0
homepage: https://github.com/a-givertzman/hmi_widgets
publish_to: none

Expand All @@ -14,15 +14,15 @@ dependencies:
fl_chart:
git:
url: https://github.com/a-givertzman/fl_chart.git
ref: master
ref: 0.63.0+2
hmi_core:
git:
url: https://github.com/a-givertzman/hmi_core.git
ref: master
ref: 1.0.0
hmi_networking:
git:
url: https://github.com/a-givertzman/hmi_networking.git
ref: master
ref: 1.0.0
another_flushbar: ^1.12.29

dev_dependencies:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:hmi_core/hmi_core.dart';
import 'package:hmi_core/hmi_core_result_new.dart';
import 'package:hmi_widgets/src/charts/crane_load_chart/crane_load_chart_legend_json.dart';
import 'fake_json_list.dart';
void main() {
Expand Down Expand Up @@ -61,7 +62,7 @@ void main() {
for (final config in validLegendConfigs) {
final list = config['list'] as List<Map<String, dynamic>>;
final legendJson = CraneLoadChartLegendJson(
jsonList: FakeJsonList(list),
jsonList: FakeJsonList(Ok(list)),
);
final decodedLegend = await legendJson.decoded;
expect(
Expand Down Expand Up @@ -106,7 +107,7 @@ void main() {
];
for (final invalidConfig in invalidJsonConfigs) {
final legendData = CraneLoadChartLegendJson(
jsonList: FakeJsonList(invalidConfig),
jsonList: FakeJsonList(Ok(invalidConfig)),
);
expect(
legendData.decoded,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import 'package:hmi_core/hmi_core.dart';
import 'package:hmi_core/hmi_core_result_new.dart';
///
class FakeJsonList<T> implements JsonList<T> {
final List<T> _list;
const FakeJsonList(this._list);
final ResultF<List<T>> _decodedResult;
const FakeJsonList(this._decodedResult);
@override
Future<List<T>> get decoded => Future.value(_list);
Future<ResultF<List<T>>> get decoded => Future.value(_decodedResult);
}
12 changes: 9 additions & 3 deletions test/unit/charts/crane_load_chart/swl_data/fake_text_file.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
import 'package:hmi_core/hmi_core.dart';
import 'package:hmi_core/hmi_core_result_new.dart';
///
class FakeTextFile implements TextFile {
final String _content;
const FakeTextFile(this._content);
String contentText;
FakeTextFile(this.contentText);
@override
Future<String> get content => Future.value(_content);
Future<ResultF<String>> get content => Future.value(Ok(contentText));

@override
Future<void> write(String text) async {
contentText = text;
}

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import 'package:hmi_core/hmi_core.dart';
import 'package:hmi_core/hmi_core_result_new.dart';
///
class FakeJsonMap<T> implements JsonMap<T> {
final Map<String, T> _decoded;
final ResultF<Map<String, T>> _decodedResult;
///
const FakeJsonMap(this._decoded);
const FakeJsonMap(this._decodedResult);
//
@override
Future<Map<String, T>> get decoded => Future.value(_decoded);
Future<ResultF<Map<String, T>>> get decoded => Future.value(_decodedResult);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:hmi_core/hmi_core.dart';
import 'package:hmi_core/hmi_core_result_new.dart';
import 'package:hmi_widgets/src/edit_field/network_dropdown_field/oil_data.dart';
import 'fake_json_map.dart';
void main() {
Expand Down Expand Up @@ -57,7 +58,7 @@ void main() {
final oilJsonMap = entry['json_map'] as Map<String, Map<String, dynamic>>;
final names = entry['names'] as List<String>;
final oilData = OilData(
jsonMap: FakeJsonMap(oilJsonMap),
jsonMap: FakeJsonMap(Ok(oilJsonMap)),
);
expect(await oilData.names(), names);
}
Expand Down
Loading