Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
null check future return value and use local variable
  • Loading branch information
bparrishMines committed Jan 11, 2021
commit 08b6bd23bcbfc75740ec661c97d43963bdff83e7
11 changes: 5 additions & 6 deletions packages/package_info/lib/package_info.dart
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,13 @@ class PackageInfo {
/// Retrieves package information from the platform.
/// The result is cached.
static Future<PackageInfo> fromPlatform() async {
if (_fromPlatform != null) {
return _fromPlatform!;
}
final PackageInfo? packageInfo = _fromPlatform;
if (packageInfo != null) return packageInfo;

final Map<String, dynamic>? map =
await _kChannel.invokeMapMethod<String, dynamic>('getAll');
final Map<String, dynamic> map =
(await _kChannel.invokeMapMethod<String, dynamic>('getAll'))!;
return _fromPlatform = PackageInfo(
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's probably a bit more readable to have this as two separate statements

appName: map!["appName"],
appName: map["appName"],
packageName: map["packageName"],
version: map["version"],
buildNumber: map["buildNumber"],
Expand Down