fix(clippy): apply auto-fixable linting suggestions
This commit is contained in:
@@ -1,25 +1,25 @@
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'bootstrap_token.g.dart';
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
class BootstrapToken extends _$BootstrapToken {
|
||||
@override
|
||||
String? build() {
|
||||
return null;
|
||||
}
|
||||
|
||||
void set(String token) {
|
||||
state = token;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
state = null;
|
||||
}
|
||||
|
||||
String? take() {
|
||||
final token = state;
|
||||
state = null;
|
||||
return token;
|
||||
}
|
||||
}
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'bootstrap_token.g.dart';
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
class BootstrapToken extends _$BootstrapToken {
|
||||
@override
|
||||
String? build() {
|
||||
return null;
|
||||
}
|
||||
|
||||
void set(String token) {
|
||||
state = token;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
state = null;
|
||||
}
|
||||
|
||||
String? take() {
|
||||
final token = state;
|
||||
state = null;
|
||||
return token;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,62 +1,62 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'bootstrap_token.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint, type=warning
|
||||
|
||||
@ProviderFor(BootstrapToken)
|
||||
final bootstrapTokenProvider = BootstrapTokenProvider._();
|
||||
|
||||
final class BootstrapTokenProvider
|
||||
extends $NotifierProvider<BootstrapToken, String?> {
|
||||
BootstrapTokenProvider._()
|
||||
: super(
|
||||
from: null,
|
||||
argument: null,
|
||||
retry: null,
|
||||
name: r'bootstrapTokenProvider',
|
||||
isAutoDispose: false,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@override
|
||||
String debugGetCreateSourceHash() => _$bootstrapTokenHash();
|
||||
|
||||
@$internal
|
||||
@override
|
||||
BootstrapToken create() => BootstrapToken();
|
||||
|
||||
/// {@macro riverpod.override_with_value}
|
||||
Override overrideWithValue(String? value) {
|
||||
return $ProviderOverride(
|
||||
origin: this,
|
||||
providerOverride: $SyncValueProvider<String?>(value),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
String _$bootstrapTokenHash() => r'5c09ea4480fc3a7fd0d0a0bced712912542cca5d';
|
||||
|
||||
abstract class _$BootstrapToken extends $Notifier<String?> {
|
||||
String? build();
|
||||
@$mustCallSuper
|
||||
@override
|
||||
void runBuild() {
|
||||
final ref = this.ref as $Ref<String?, String?>;
|
||||
final element =
|
||||
ref.element
|
||||
as $ClassProviderElement<
|
||||
AnyNotifier<String?, String?>,
|
||||
String?,
|
||||
Object?,
|
||||
Object?
|
||||
>;
|
||||
element.handleCreate(ref, build);
|
||||
}
|
||||
}
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'bootstrap_token.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint, type=warning
|
||||
|
||||
@ProviderFor(BootstrapToken)
|
||||
final bootstrapTokenProvider = BootstrapTokenProvider._();
|
||||
|
||||
final class BootstrapTokenProvider
|
||||
extends $NotifierProvider<BootstrapToken, String?> {
|
||||
BootstrapTokenProvider._()
|
||||
: super(
|
||||
from: null,
|
||||
argument: null,
|
||||
retry: null,
|
||||
name: r'bootstrapTokenProvider',
|
||||
isAutoDispose: false,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@override
|
||||
String debugGetCreateSourceHash() => _$bootstrapTokenHash();
|
||||
|
||||
@$internal
|
||||
@override
|
||||
BootstrapToken create() => BootstrapToken();
|
||||
|
||||
/// {@macro riverpod.override_with_value}
|
||||
Override overrideWithValue(String? value) {
|
||||
return $ProviderOverride(
|
||||
origin: this,
|
||||
providerOverride: $SyncValueProvider<String?>(value),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
String _$bootstrapTokenHash() => r'5c09ea4480fc3a7fd0d0a0bced712912542cca5d';
|
||||
|
||||
abstract class _$BootstrapToken extends $Notifier<String?> {
|
||||
String? build();
|
||||
@$mustCallSuper
|
||||
@override
|
||||
void runBuild() {
|
||||
final ref = this.ref as $Ref<String?, String?>;
|
||||
final element =
|
||||
ref.element
|
||||
as $ClassProviderElement<
|
||||
AnyNotifier<String?, String?>,
|
||||
String?,
|
||||
Object?,
|
||||
Object?
|
||||
>;
|
||||
element.handleCreate(ref, build);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,46 +1,46 @@
|
||||
import 'package:arbiter/features/connection/auth.dart';
|
||||
import 'package:arbiter/features/connection/connection.dart';
|
||||
import 'package:arbiter/providers/connection/bootstrap_token.dart';
|
||||
import 'package:arbiter/providers/key.dart';
|
||||
import 'package:arbiter/providers/server_info.dart';
|
||||
import 'package:mtcore/markettakers.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'connection_manager.g.dart';
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
class ConnectionManager extends _$ConnectionManager {
|
||||
@override
|
||||
Future<Connection?> build() async {
|
||||
final serverInfo = await ref.watch(serverInfoProvider.future);
|
||||
final key = await ref.watch(keyProvider.future);
|
||||
final token = ref.read(bootstrapTokenProvider);
|
||||
|
||||
if (serverInfo == null || key == null) {
|
||||
return null;
|
||||
}
|
||||
final Connection connection;
|
||||
try {
|
||||
connection = await connectAndAuthorize(
|
||||
serverInfo,
|
||||
key,
|
||||
bootstrapToken: token,
|
||||
);
|
||||
if (token != null) {
|
||||
ref.read(bootstrapTokenProvider.notifier).clear();
|
||||
}
|
||||
} catch (e) {
|
||||
talker.handle(e);
|
||||
rethrow;
|
||||
}
|
||||
|
||||
ref.onDispose(() {
|
||||
final connection = state.asData?.value;
|
||||
if (connection != null) {
|
||||
connection.close();
|
||||
}
|
||||
});
|
||||
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
import 'package:arbiter/features/connection/auth.dart';
|
||||
import 'package:arbiter/features/connection/connection.dart';
|
||||
import 'package:arbiter/providers/connection/bootstrap_token.dart';
|
||||
import 'package:arbiter/providers/key.dart';
|
||||
import 'package:arbiter/providers/server_info.dart';
|
||||
import 'package:mtcore/markettakers.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
|
||||
part 'connection_manager.g.dart';
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
class ConnectionManager extends _$ConnectionManager {
|
||||
@override
|
||||
Future<Connection?> build() async {
|
||||
final serverInfo = await ref.watch(serverInfoProvider.future);
|
||||
final key = await ref.watch(keyProvider.future);
|
||||
final token = ref.read(bootstrapTokenProvider);
|
||||
|
||||
if (serverInfo == null || key == null) {
|
||||
return null;
|
||||
}
|
||||
final Connection connection;
|
||||
try {
|
||||
connection = await connectAndAuthorize(
|
||||
serverInfo,
|
||||
key,
|
||||
bootstrapToken: token,
|
||||
);
|
||||
if (token != null) {
|
||||
ref.read(bootstrapTokenProvider.notifier).clear();
|
||||
}
|
||||
} catch (e) {
|
||||
talker.handle(e);
|
||||
rethrow;
|
||||
}
|
||||
|
||||
ref.onDispose(() {
|
||||
final connection = state.asData?.value;
|
||||
if (connection != null) {
|
||||
connection.close();
|
||||
}
|
||||
});
|
||||
|
||||
return connection;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,54 +1,54 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'connection_manager.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint, type=warning
|
||||
|
||||
@ProviderFor(ConnectionManager)
|
||||
final connectionManagerProvider = ConnectionManagerProvider._();
|
||||
|
||||
final class ConnectionManagerProvider
|
||||
extends $AsyncNotifierProvider<ConnectionManager, Connection?> {
|
||||
ConnectionManagerProvider._()
|
||||
: super(
|
||||
from: null,
|
||||
argument: null,
|
||||
retry: null,
|
||||
name: r'connectionManagerProvider',
|
||||
isAutoDispose: false,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@override
|
||||
String debugGetCreateSourceHash() => _$connectionManagerHash();
|
||||
|
||||
@$internal
|
||||
@override
|
||||
ConnectionManager create() => ConnectionManager();
|
||||
}
|
||||
|
||||
String _$connectionManagerHash() => r'f471afb49bdcde77238424942f5af1716634f084';
|
||||
|
||||
abstract class _$ConnectionManager extends $AsyncNotifier<Connection?> {
|
||||
FutureOr<Connection?> build();
|
||||
@$mustCallSuper
|
||||
@override
|
||||
void runBuild() {
|
||||
final ref = this.ref as $Ref<AsyncValue<Connection?>, Connection?>;
|
||||
final element =
|
||||
ref.element
|
||||
as $ClassProviderElement<
|
||||
AnyNotifier<AsyncValue<Connection?>, Connection?>,
|
||||
AsyncValue<Connection?>,
|
||||
Object?,
|
||||
Object?
|
||||
>;
|
||||
element.handleCreate(ref, build);
|
||||
}
|
||||
}
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'connection_manager.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint, type=warning
|
||||
|
||||
@ProviderFor(ConnectionManager)
|
||||
final connectionManagerProvider = ConnectionManagerProvider._();
|
||||
|
||||
final class ConnectionManagerProvider
|
||||
extends $AsyncNotifierProvider<ConnectionManager, Connection?> {
|
||||
ConnectionManagerProvider._()
|
||||
: super(
|
||||
from: null,
|
||||
argument: null,
|
||||
retry: null,
|
||||
name: r'connectionManagerProvider',
|
||||
isAutoDispose: false,
|
||||
dependencies: null,
|
||||
$allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
@override
|
||||
String debugGetCreateSourceHash() => _$connectionManagerHash();
|
||||
|
||||
@$internal
|
||||
@override
|
||||
ConnectionManager create() => ConnectionManager();
|
||||
}
|
||||
|
||||
String _$connectionManagerHash() => r'f471afb49bdcde77238424942f5af1716634f084';
|
||||
|
||||
abstract class _$ConnectionManager extends $AsyncNotifier<Connection?> {
|
||||
FutureOr<Connection?> build();
|
||||
@$mustCallSuper
|
||||
@override
|
||||
void runBuild() {
|
||||
final ref = this.ref as $Ref<AsyncValue<Connection?>, Connection?>;
|
||||
final element =
|
||||
ref.element
|
||||
as $ClassProviderElement<
|
||||
AnyNotifier<AsyncValue<Connection?>, Connection?>,
|
||||
AsyncValue<Connection?>,
|
||||
Object?,
|
||||
Object?
|
||||
>;
|
||||
element.handleCreate(ref, build);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user