Skip to content

Commit

Permalink
chore(user): removes unnecessary null check PE-4477
Browse files Browse the repository at this point in the history
  • Loading branch information
matibat committed Sep 26, 2023
1 parent 75991d6 commit 37dfde5
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions lib/blocs/upload/upload_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ class UploadCubit extends Cubit<UploadState> {
try {
final uploadPreparation = await _arDriveUploadManager.prepareUpload(
params: UploadParams(
user: _auth.currentUser!,
user: _auth.currentUser,
files: files,
targetFolder: _targetFolder,
targetDrive: _targetDrive,
Expand Down Expand Up @@ -351,7 +351,7 @@ class UploadCubit extends Cubit<UploadState> {
'UploadPlan For AR: ${uploadPreparation.uploadPaymentInfo.arCostEstimate.toString()}\n'
'UploadPlan For Turbo: ${uploadPreparation.uploadPlansPreparation.uploadPlanForTurbo.toString()}\n'
'Turbo Balance: ${uploadPreparation.uploadPaymentInfo.turboBalance}\n'
'AR Balance: ${_auth.currentUser!.walletBalance}\n'
'AR Balance: ${_auth.currentUser.walletBalance}\n'
'Is Turbo Upload Possible: ${paymentInfo.isUploadEligibleToTurbo}\n'
'Is Zero Balance: $isTurboZeroBalance\n',
);
Expand Down Expand Up @@ -396,7 +396,7 @@ class UploadCubit extends Cubit<UploadState> {
costEstimateTurbo: paymentInfo.turboCostEstimate,
credits: literalBalance,
arBalance:
convertCreditsToLiteralString(_auth.currentUser!.walletBalance),
convertCreditsToLiteralString(_auth.currentUser.walletBalance),
uploadIsPublic: _targetDrive.isPublic,
sufficientArBalance:
profile.walletBalance >= paymentInfo.arCostEstimate.totalCost,
Expand Down Expand Up @@ -530,7 +530,7 @@ class UploadCubit extends Cubit<UploadState> {
}

ArDriveUploader _getUploader() {
final wallet = _auth.currentUser!.wallet;
final wallet = _auth.currentUser.wallet;

final turboUploader = TurboUploader(_turbo, wallet);
final arweaveUploader = ArweaveBundleUploader(_arweave.client);
Expand Down Expand Up @@ -558,7 +558,7 @@ class UploadCubit extends Cubit<UploadState> {
arweaveService: _arweave,
turboUploadService: _turbo,
pstService: _pst,
wallet: _auth.currentUser!.wallet,
wallet: _auth.currentUser.wallet,
isArConnect: await _profileCubit.isCurrentProfileArConnect(),
useTurbo: _uploadMethod == UploadMethod.turbo,
);
Expand Down
2 changes: 1 addition & 1 deletion lib/components/upload_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Future<void> promptToUpload(
),
turboUploadCostCalculator: TurboUploadCostCalculator(
priceEstimator: TurboPriceEstimator(
wallet: context.read<ArDriveAuth>().currentUser!.wallet,
wallet: context.read<ArDriveAuth>().currentUser.wallet,
costCalculator: TurboCostCalculator(
paymentService: context.read<PaymentService>(),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/core/upload/uploader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ class UploadPaymentEvaluator {
/// If we can't get the balance, turbo won't be available
try {
turboBalance =
await _turboBalanceRetriever.getBalance(_auth.currentUser!.wallet);
await _turboBalanceRetriever.getBalance(_auth.currentUser.wallet);

logger.i('Turbo balance: $turboBalance');
} catch (e, stacktrace) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class DriveFileDropZoneState extends State<DriveFileDropZone> {
),
turboUploadCostCalculator: TurboUploadCostCalculator(
priceEstimator: TurboPriceEstimator(
wallet: context.read<ArDriveAuth>().currentUser!.wallet,
wallet: context.read<ArDriveAuth>().currentUser.wallet,
costCalculator: TurboCostCalculator(
paymentService: context.read<PaymentService>(),
),
Expand Down
4 changes: 2 additions & 2 deletions lib/turbo/topup/views/topup_modal.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void showTurboModal(BuildContext context, {Function()? onSuccess}) {
);

final priceEstimator = TurboPriceEstimator(
wallet: context.read<ArDriveAuth>().currentUser!.wallet,
wallet: context.read<ArDriveAuth>().currentUser.wallet,
paymentService: context.read<PaymentService>(),
costCalculator: costCalculator,
);
Expand All @@ -51,7 +51,7 @@ void showTurboModal(BuildContext context, {Function()? onSuccess}) {
balanceRetriever: balanceRetriever,
priceEstimator: priceEstimator,
paymentProvider: turboPaymentProvider,
wallet: context.read<ArDriveAuth>().currentUser!.wallet,
wallet: context.read<ArDriveAuth>().currentUser.wallet,
supportedCountriesRetriever: turboSupportedCountriesRetriever,
);

Expand Down
2 changes: 1 addition & 1 deletion lib/user/download_wallet/bloc/download_wallet_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DownloadWalletBloc
return;
}
try {
final wallet = _ardriveAuth.currentUser!.wallet;
final wallet = _ardriveAuth.currentUser.wallet;

await _ardriveIOUtils.downloadWalletAsJsonFile(
wallet: wallet,
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/user_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:ardrive/user/user.dart';
bool isDriveOwner(ArDriveAuth auth, String driveOwner) {
User user;
try {
user = auth.currentUser!;
user = auth.currentUser;
} catch (e) {
return false;
}
Expand Down

0 comments on commit 37dfde5

Please sign in to comment.