Skip to content

Commit

Permalink
refactor: Rename param
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmah309 committed Dec 2, 2024
1 parent 0c7890a commit e85b969
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 32 deletions.
41 changes: 20 additions & 21 deletions packages/signals_core/lib/src/async/computed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ FutureSignal<T> computedFrom<T, A>(
/// [computedFrom] for one element.
FutureSignal<T> computedFrom1<T, A>(
ReadonlySignal<A> signal1,
Future<T> Function(A signal1) fn, {
Future<T> Function(A value1) fn, {
T? initialValue,
String? debugLabel,
bool autoDispose = false,
bool lazy = true,
}) {
return FutureSignal<T>(
() => fn(signal1.value),
() => fn(signal1()),
dependencies: [signal1],
initialValue: initialValue,
debugLabel: debugLabel,
Expand All @@ -56,16 +56,16 @@ FutureSignal<T> computedFrom2<T, A, B>(
ReadonlySignal<A> signal1,
ReadonlySignal<B> signal2,
Future<T> Function(
A signal1,
B signal2,
A value1,
B value2,
) fn, {
T? initialValue,
String? debugLabel,
bool autoDispose = false,
bool lazy = true,
}) {
return FutureSignal<T>(
() => fn(signal1.value, signal2.value),
() => fn(signal1(), signal2()),
dependencies: [signal1, signal2],
initialValue: initialValue,
debugLabel: debugLabel,
Expand All @@ -80,17 +80,17 @@ FutureSignal<T> computedFrom3<T, A, B, C>(
ReadonlySignal<B> signal2,
ReadonlySignal<C> signal3,
Future<T> Function(
A signal1,
B signal2,
C signal3,
A value1,
B value2,
C value3,
) fn, {
T? initialValue,
String? debugLabel,
bool autoDispose = false,
bool lazy = true,
}) {
return FutureSignal<T>(
() => fn(signal1.value, signal2.value, signal3.value),
() => fn(signal1(), signal2(), signal3()),
dependencies: [signal1, signal2, signal3],
initialValue: initialValue,
debugLabel: debugLabel,
Expand All @@ -106,18 +106,18 @@ FutureSignal<T> computedFrom4<T, A, B, C, D>(
ReadonlySignal<C> signal3,
ReadonlySignal<D> signal4,
Future<T> Function(
A signal1,
B signal2,
C signal3,
D signal4,
A value1,
B value2,
C value3,
D value4,
) fn, {
T? initialValue,
String? debugLabel,
bool autoDispose = false,
bool lazy = true,
}) {
return FutureSignal<T>(
() => fn(signal1.value, signal2.value, signal3.value, signal4.value),
() => fn(signal1(), signal2(), signal3(), signal4()),
dependencies: [signal1, signal2, signal3, signal4],
initialValue: initialValue,
debugLabel: debugLabel,
Expand All @@ -134,20 +134,19 @@ FutureSignal<T> computedFrom5<T, A, B, C, D, E>(
ReadonlySignal<D> signal4,
ReadonlySignal<E> signal5,
Future<T> Function(
A signal1,
B signal2,
C signal3,
D signal4,
E signal5,
A value1,
B value2,
C value3,
D value4,
E value5,
) fn, {
T? initialValue,
String? debugLabel,
bool autoDispose = false,
bool lazy = true,
}) {
return FutureSignal<T>(
() => fn(signal1.value, signal2.value, signal3.value, signal4.value,
signal5.value),
() => fn(signal1(), signal2(), signal3(), signal4(), signal5()),
dependencies: [signal1, signal2, signal3, signal4, signal5],
initialValue: initialValue,
debugLabel: debugLabel,
Expand Down
21 changes: 10 additions & 11 deletions packages/signals_flutter/lib/src/mixins/signals.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ mixin SignalsMixin<T extends StatefulWidget> on State<T> {
));
}

/// [createComputedFrom] for a one element.
/// [createComputedFrom] for one element.
FutureSignal<S> createComputedFrom1<S, A>(
ReadonlySignal<A> signal1,
Future<S> Function(A signal1) fn, {
Future<S> Function(A value1) fn, {
S? initialValue,
String? debugLabel,
bool lazy = true,
Expand All @@ -142,11 +142,11 @@ mixin SignalsMixin<T extends StatefulWidget> on State<T> {
));
}

/// [createComputedFrom] for a two elements.
/// [createComputedFrom] for two elements.
FutureSignal<S> createComputedFrom2<S, A, B>(
ReadonlySignal<A> signal1,
ReadonlySignal<B> signal2,
Future<S> Function(A signal1, B signal2) fn, {
Future<S> Function(A value1, B value2) fn, {
S? initialValue,
String? debugLabel,
bool lazy = true,
Expand All @@ -161,12 +161,12 @@ mixin SignalsMixin<T extends StatefulWidget> on State<T> {
));
}

/// [createComputedFrom] for a three elements.
/// [createComputedFrom] for three elements.
FutureSignal<S> createComputedFrom3<S, A, B, C>(
ReadonlySignal<A> signal1,
ReadonlySignal<B> signal2,
ReadonlySignal<C> signal3,
Future<S> Function(A signal1, B signal2, C signal3) fn, {
Future<S> Function(A value1, B value2, C value3) fn, {
S? initialValue,
String? debugLabel,
bool lazy = true,
Expand All @@ -182,13 +182,13 @@ mixin SignalsMixin<T extends StatefulWidget> on State<T> {
));
}

/// [createComputedFrom] for a four elements.
/// [createComputedFrom] for four elements.
FutureSignal<S> createComputedFrom4<S, A, B, C, D>(
ReadonlySignal<A> signal1,
ReadonlySignal<B> signal2,
ReadonlySignal<C> signal3,
ReadonlySignal<D> signal4,
Future<S> Function(A signal1, B signal2, C signal3, D signal4) fn, {
Future<S> Function(A value1, B value2, C value3, D value4) fn, {
S? initialValue,
String? debugLabel,
bool lazy = true,
Expand All @@ -205,15 +205,14 @@ mixin SignalsMixin<T extends StatefulWidget> on State<T> {
));
}

/// [createComputedFrom] for a five elements.
/// [createComputedFrom] for five elements.
FutureSignal<S> createComputedFrom5<S, A, B, C, D, E>(
ReadonlySignal<A> signal1,
ReadonlySignal<B> signal2,
ReadonlySignal<C> signal3,
ReadonlySignal<D> signal4,
ReadonlySignal<E> signal5,
Future<S> Function(A signal1, B signal2, C signal3, D signal4, E signal5)
fn, {
Future<S> Function(A value1, B value2, C value3, D value, E value5) fn, {
S? initialValue,
String? debugLabel,
bool lazy = true,
Expand Down

0 comments on commit e85b969

Please sign in to comment.