Skip to content

Commit

Permalink
fix: zero warning on flutter analyze
Browse files Browse the repository at this point in the history
  • Loading branch information
ali77gh committed Mar 28, 2023
1 parent 6f71a39 commit 672bb0e
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 12 deletions.
6 changes: 3 additions & 3 deletions example/integration_test/entry_point_test.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:integration_test/integration_test.dart';

import './01.dart' as example01;
import './02.dart' as example02;
import './03.dart' as example03;
import './example_01.dart' as example01;
import './example_02.dart' as example02;
import './example_03.dart' as example03;

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class DependObservableAsyncSampleLayoutState
late Telescope<int> weight;
late Telescope<double> bmi;
late Telescope<String> showingText;
var loadingBMI = Telescope(false);
var loadingBMI = Telescope(false);

@override
void initState() {
Expand All @@ -31,7 +31,11 @@ class DependObservableAsyncSampleLayoutState

showingText = Telescope.dependsOn([height, weight, bmi, loadingBMI], () {
var bmis = bmi.value.toString();
bmis = loadingBMI.value ? "..." : bmis.length > 5 ? bmis.substring(0, 5) : bmis;
bmis = loadingBMI.value
? "..."
: bmis.length > 5
? bmis.substring(0, 5)
: bmis;

return "weight is ${weight.value} and height is ${height.value} so bmi will be $bmis";
});
Expand Down
11 changes: 6 additions & 5 deletions lib/src/telescope.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,12 @@ class Telescope<T> {
/// Async version of [Telescope.dependsOn]
/// Use this if you need to use await in calculate function
Telescope.dependsOnAsync(
this.holden, List<Telescope> dependencies, Future<T> Function() calculate,
{
this.iWillCallNotifyAll = false,
Telescope<bool>? isCalculating,
}) {
this.holden,
List<Telescope> dependencies,
Future<T> Function() calculate, {
this.iWillCallNotifyAll = false,
Telescope<bool>? isCalculating,
}) {
isCalculating?.value = true;
calculate().then((value) {
holden = value;
Expand Down
2 changes: 2 additions & 0 deletions test/save_and_load_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class Human {
String name = "";
@override
int get hashCode => name.hashCode;
@override
bool operator ==(Object other) => hashCode == other.hashCode;
}

class HumanSerializer extends OnDiskSaveAbility<Human> {
Expand Down
7 changes: 5 additions & 2 deletions test/type_check_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ class HashCodeHuman {
int age = 18;
@override
int get hashCode => age.hashCode;

@override
bool operator ==(Object other) => hashCode == other.hashCode;
}

void implementsHashCodeTest() {
Expand Down Expand Up @@ -94,7 +97,7 @@ void checkValidTypeTest() {
test("not supported Human", () {
expect(() {
TypeCheck.checkIsValidType<Human>(Human(), false);
}, throwsA(TypeMatcher()));
}, throwsA(const TypeMatcher()));
});

test("not supported Human iWillCallNotifyAll", () {
Expand Down Expand Up @@ -123,7 +126,7 @@ void checkValidTypeItemsTest() {
test("not supported Human", () {
expect(() {
TypeCheck.checkIsValidTypeForItems([Human(), Human()], false);
}, throwsA(TypeMatcher()));
}, throwsA(const TypeMatcher()));
});

test("not supported Human list iWillCallNotifyAll", () {
Expand Down

0 comments on commit 672bb0e

Please sign in to comment.