From cf455db7e032276500f2d02b013ac7d338285f6f Mon Sep 17 00:00:00 2001 From: Victor Porton Date: Thu, 9 Feb 2023 12:41:09 +0200 Subject: [PATCH 1/2] T? for result --- example/places_autocomplete.dart | 6 +++--- lib/src/core.dart | 2 +- lib/src/places.dart | 2 +- lib/src/places.g.dart | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/example/places_autocomplete.dart b/example/places_autocomplete.dart index 3912e81..0e93728 100644 --- a/example/places_autocomplete.dart +++ b/example/places_autocomplete.dart @@ -26,9 +26,9 @@ Future main() async { ); print('\nDetails :'); - print(details.result.formattedAddress); - print(details.result.formattedPhoneNumber); - print(details.result.url); + print(details.result!.formattedAddress); + print(details.result!.formattedPhoneNumber); + print(details.result!.url); } else { print(res.errorMessage); } diff --git a/lib/src/core.dart b/lib/src/core.dart index a01c078..900c848 100644 --- a/lib/src/core.dart +++ b/lib/src/core.dart @@ -98,7 +98,7 @@ abstract class GoogleResponseList extends GoogleResponseStatus { } abstract class GoogleResponse extends GoogleResponseStatus { - final T result; + final T? result; GoogleResponse(String status, String? errorMessage, this.result) : super(status: status, errorMessage: errorMessage); diff --git a/lib/src/places.dart b/lib/src/places.dart index 7eb8933..170fffc 100644 --- a/lib/src/places.dart +++ b/lib/src/places.dart @@ -818,7 +818,7 @@ enum PriceLevel { @JsonSerializable() class PlacesDetailsResponse extends GoogleResponseStatus { - final PlaceDetails result; + final PlaceDetails? result; /// JSON html_attributions @JsonKey(defaultValue: []) diff --git a/lib/src/places.g.dart b/lib/src/places.g.dart index b7a3fd7..d564d17 100644 --- a/lib/src/places.g.dart +++ b/lib/src/places.g.dart @@ -291,7 +291,7 @@ PlacesDetailsResponse _$PlacesDetailsResponseFromJson( return PlacesDetailsResponse( status: json['status'] as String, errorMessage: json['error_message'] as String?, - result: PlaceDetails.fromJson(json['result'] as Map), + result: json['status'] == 'OK' ? PlaceDetails.fromJson(json['result'] as Map) : null, htmlAttributions: (json['html_attributions'] as List?) ?.map((e) => e as String) .toList() ?? From 9edd7fe3c6001c7f25b70b7cd20d2bf512c9ed77 Mon Sep 17 00:00:00 2001 From: mathematician Date: Fri, 24 Jan 2025 19:44:49 +0200 Subject: [PATCH 2/2] Add FUNDING.yml --- .github/FUNDING.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/FUNDING.yml diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..4ae4509 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,15 @@ +# These are supported funding model platforms + +github: vporton # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] +patreon: # Replace with a single Patreon username +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +polar: # Replace with a single Polar username +buy_me_a_coffee: # Replace with a single Buy Me a Coffee username +thanks_dev: # Replace with a single thanks.dev username +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] \ No newline at end of file