Skip to content

Commit

Permalink
chore: use factory constructor and _fileStorage might be null in remo…
Browse files Browse the repository at this point in the history
…teConstraint
  • Loading branch information
khatruong2009 committed Sep 15, 2023
1 parent 9ecffbf commit 8750486
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

import 'file_storage_stub.dart'
import 'package:amplify_core/amplify_core.dart';
import 'package:aws_logging_cloudwatch/src/file_storage/file_storage_stub.dart'
if (dart.library.io) 'file_storage_vm.dart'
if (dart.library.html) 'file_storage_web.dart';

/// File storage interface for saving and loading constraint locally
abstract interface class FileStorage {
/// Default Constructor or FileStorage
factory FileStorage(AppPathProvider pathProvider) = FileStorageImpl;

/// Save constraint locally to file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ base class BaseRemoteLoggingConstraintProvider
_loggingConstraint = fetchedConstraint;

if (_fileStorage != null) {
await _fileStorage!.save(
await _fileStorage?.save(
_cacheFileName,
jsonEncode(fetchedConstraint.toJson()),
);
Expand Down

0 comments on commit 8750486

Please sign in to comment.