From 36ded16eff0326146e403364a2955bafd2099525 Mon Sep 17 00:00:00 2001 From: manavmodi Date: Tue, 1 Oct 2024 14:07:08 -0500 Subject: [PATCH 1/5] Moving the places building block support from the other branch to this branch off v1.7 --- example/pubspec.lock | 234 +++++++++++++++++++--------------------- lib/model/places.dart | 86 +++++++++++++++ lib/model/places.g.dart | 66 ++++++++++++ lib/service/config.dart | 1 + lib/service/places.dart | 135 +++++++++++++++++++++++ pubspec.yaml | 8 +- 6 files changed, 406 insertions(+), 124 deletions(-) create mode 100644 lib/model/places.dart create mode 100644 lib/model/places.g.dart create mode 100644 lib/service/places.dart diff --git a/example/pubspec.lock b/example/pubspec.lock index c9171c5fc..6056734cb 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -5,26 +5,26 @@ packages: dependency: transitive description: name: _flutterfire_internals - sha256: b46f62516902afb04befa4b30eb6a12ac1f58ca8cb25fb9d632407259555dd3d + sha256: "5534e701a2c505fed1f0799e652dd6ae23bd4d2c4cf797220e5ced5764a7c1c2" url: "https://pub.dev" source: hosted - version: "1.3.39" + version: "1.3.44" args: dependency: transitive description: name: args - sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" url: "https://pub.dev" source: hosted - version: "2.4.2" + version: "2.5.0" asn1lib: dependency: transitive description: name: asn1lib - sha256: c9c85fedbe2188b95133cbe960e16f5f448860f7133330e272edbbca5893ddc6 + sha256: "6b151826fcc95ff246cd219a0bf4c753ea14f4081ad71c61939becf3aba27f70" url: "https://pub.dev" source: hosted - version: "1.5.2" + version: "1.5.5" async: dependency: transitive description: @@ -69,18 +69,18 @@ packages: dependency: transitive description: name: connectivity_plus - sha256: db7a4e143dc72cc3cb2044ef9b052a7ebfe729513e6a82943bc3526f784365b8 + sha256: "2056db5241f96cdc0126bd94459fc4cdc13876753768fc7a31c425e50a7177d0" url: "https://pub.dev" source: hosted - version: "6.0.3" + version: "6.0.5" connectivity_plus_platform_interface: dependency: transitive description: name: connectivity_plus_platform_interface - sha256: b6a56efe1e6675be240de39107281d4034b64ac23438026355b4234042a35adb + sha256: "42657c1715d48b167930d5f34d00222ac100475f73d10162ddf43e714932f204" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "2.0.1" convert: dependency: transitive description: @@ -101,18 +101,18 @@ packages: dependency: transitive description: name: cross_file - sha256: "74a4727e030347edff3b6e5256b7fb0c3de8af8ed278e6c56718760786a1fa40" + sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670" url: "https://pub.dev" source: hosted - version: "0.3.4" + version: "0.3.4+2" crypto: dependency: transitive description: name: crypto - sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + sha256: ec30d999af904f33454ba22ed9a86162b35e52b44ac4807d1d93c288041d7d27 url: "https://pub.dev" source: hosted - version: "3.0.3" + version: "3.0.5" csslib: dependency: transitive description: @@ -125,10 +125,10 @@ packages: dependency: "direct main" description: name: cupertino_icons - sha256: d57953e10f9f8327ce64a508a355f0b1ec902193f66288e8cb5070e7c47eeb2d + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "1.0.8" dbus: dependency: transitive description: @@ -141,10 +141,10 @@ packages: dependency: transitive description: name: device_calendar - sha256: "991b55bb9e0a0850ec9367af8227fe25185210da4f5fa7bd15db4cc813b1e2e5" + sha256: "683fb93ec302b6a65c0ce57df40ff9dcc2404f59c67a2f8b93e59318c8a0a225" url: "https://pub.dev" source: hosted - version: "4.3.2" + version: "4.3.3" device_info: dependency: transitive description: @@ -181,10 +181,10 @@ packages: dependency: transitive description: name: ffi - sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" + sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.3" file: dependency: transitive description: @@ -205,10 +205,10 @@ packages: dependency: transitive description: name: file_selector_macos - sha256: b15c3da8bd4908b9918111fa486903f5808e388b8d1c559949f584725a6594d6 + sha256: cb284e267f8e2a45a904b5c094d2ba51d0aabfc20b1538ab786d9ef7dc2bf75c url: "https://pub.dev" source: hosted - version: "0.9.3+3" + version: "0.9.4+1" file_selector_platform_interface: dependency: transitive description: @@ -221,74 +221,74 @@ packages: dependency: transitive description: name: file_selector_windows - sha256: d3547240c20cabf205c7c7f01a50ecdbc413755814d6677f3cb366f04abcead0 + sha256: "8f5d2f6590d51ecd9179ba39c64f722edc15226cc93dcc8698466ad36a4a85a4" url: "https://pub.dev" source: hosted - version: "0.9.3+1" + version: "0.9.3+3" firebase_core: dependency: transitive description: name: firebase_core - sha256: "5159984ce9b70727473eb388394650677c02c925aaa6c9439905e1f30966a4d5" + sha256: "51dfe2fbf3a984787a2e7b8592f2f05c986bfedd6fdacea3f9e0a7beb334de96" url: "https://pub.dev" source: hosted - version: "3.2.0" + version: "3.6.0" firebase_core_platform_interface: dependency: transitive description: name: firebase_core_platform_interface - sha256: "1003a5a03a61fc9a22ef49f37cbcb9e46c86313a7b2e7029b9390cf8c6fc32cb" + sha256: e30da58198a6d4b49d5bce4e852f985c32cb10db329ebef9473db2b9f09ce810 url: "https://pub.dev" source: hosted - version: "5.1.0" + version: "5.3.0" firebase_core_web: dependency: transitive description: name: firebase_core_web - sha256: "23509cb3cddfb3c910c143279ac3f07f06d3120f7d835e4a5d4b42558e978712" + sha256: f967a7138f5d2ffb1ce15950e2a382924239eaa521150a8f144af34e68b3b3e5 url: "https://pub.dev" source: hosted - version: "2.17.3" + version: "2.18.1" firebase_crashlytics: dependency: transitive description: name: firebase_crashlytics - sha256: da32da3b441d1bee73ca990085a3ae174b9fb3585229f02a278a2ea42454d784 + sha256: "6899800fff1af819955aef740f18c4c8600f8b952a2a1ea97bc0872ebb257387" url: "https://pub.dev" source: hosted - version: "4.0.3" + version: "4.1.3" firebase_crashlytics_platform_interface: dependency: transitive description: name: firebase_crashlytics_platform_interface - sha256: b7567106ed57bbadaa0610774cc17a10b82ed04a1aba99790f303385ac4ba78f + sha256: "97c47b0a1779a3d4118416a3f0c6c564cc59ad89095e899893204d4b2ad08f4c" url: "https://pub.dev" source: hosted - version: "3.6.39" + version: "3.6.44" firebase_messaging: dependency: transitive description: name: firebase_messaging - sha256: "156c4292aa63a6a7d508c68ded984cb38730d2823c3265e573cb1e94983e2025" + sha256: eb6e28a3a35deda61fe8634967c84215efc19133ba58d8e0fc6c9a2af2cba05e url: "https://pub.dev" source: hosted - version: "15.0.3" + version: "15.1.3" firebase_messaging_platform_interface: dependency: transitive description: name: firebase_messaging_platform_interface - sha256: "10408c5ca242b7fc632dd5eab4caf8fdf18ebe88db6052980fa71a18d88bd200" + sha256: b316c4ee10d93d32c033644207afc282d9b2b4372f3cf9c6022f3558b3873d2d url: "https://pub.dev" source: hosted - version: "4.5.41" + version: "4.5.46" firebase_messaging_web: dependency: transitive description: name: firebase_messaging_web - sha256: c7a756e3750679407948de665735e69a368cb902940466e5d68a00ea7aba1aaa + sha256: d7f0147a1a9fe4313168e20154a01fd5cf332898de1527d3930ff77b8c7f5387 url: "https://pub.dev" source: hosted - version: "3.8.11" + version: "3.9.2" flutter: dependency: "direct main" description: flutter @@ -298,10 +298,10 @@ packages: dependency: transitive description: name: flutter_exif_rotation - sha256: "642841fa8dbedb0ac7b7f005dd24a606ce237ab2de0fedef7b3419d58b97f2a7" + sha256: f581601523bbb7fbec3a0498fe930bf6c48f627d4548d859b2772230edfbe658 url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "0.5.2" flutter_html: dependency: transitive description: @@ -322,34 +322,34 @@ packages: dependency: transitive description: name: flutter_local_notifications - sha256: c18f1de98fe0bb9dd5ba91e1330d4febc8b6a7de6aae3ffe475ef423723e72f3 + sha256: "55b9b229307a10974b26296ff29f2e132256ba4bd74266939118eaefa941cb00" url: "https://pub.dev" source: hosted - version: "16.3.2" + version: "16.3.3" flutter_local_notifications_linux: dependency: transitive description: name: flutter_local_notifications_linux - sha256: "33f741ef47b5f63cc7f78fe75eeeac7e19f171ff3c3df054d84c1e38bedb6a03" + sha256: c49bd06165cad9beeb79090b18cd1eb0296f4bf4b23b84426e37dd7c027fc3af url: "https://pub.dev" source: hosted - version: "4.0.0+1" + version: "4.0.1" flutter_local_notifications_platform_interface: dependency: transitive description: name: flutter_local_notifications_platform_interface - sha256: "7cf643d6d5022f3baed0be777b0662cce5919c0a7b86e700299f22dc4ae660ef" + sha256: "85f8d07fe708c1bdcf45037f2c0109753b26ae077e9d9e899d55971711a4ea66" url: "https://pub.dev" source: hosted - version: "7.0.0+1" + version: "7.2.0" flutter_plugin_android_lifecycle: dependency: transitive description: name: flutter_plugin_android_lifecycle - sha256: b068ffc46f82a55844acfa4fdbb61fad72fa2aef0905548419d97f0f95c456da + sha256: "9ee02950848f61c4129af3d6ec84a1cfc0e47931abc746b03e7a3bc3e8ff6eda" url: "https://pub.dev" source: hosted - version: "2.0.17" + version: "2.0.22" flutter_test: dependency: "direct dev" description: flutter @@ -372,10 +372,10 @@ packages: dependency: transitive description: name: fluttertoast - sha256: dfdde255317af381bfc1c486ed968d5a43a2ded9c931e87cbecd88767d6a71c1 + sha256: "95f349437aeebe524ef7d6c9bde3e6b4772717cf46a0eb6a3ceaddc740b297cc" url: "https://pub.dev" source: hosted - version: "8.2.4" + version: "8.2.8" font_awesome_flutter: dependency: transitive description: @@ -412,18 +412,18 @@ packages: dependency: transitive description: name: geolocator_apple - sha256: "2f2d4ee16c4df269e93c0e382be075cc01d5db6703c3196e4af20a634fe49ef4" + sha256: bc2aca02423ad429cb0556121f56e60360a2b7d694c8570301d06ea0c00732fd url: "https://pub.dev" source: hosted - version: "2.3.6" + version: "2.3.7" geolocator_platform_interface: dependency: transitive description: name: geolocator_platform_interface - sha256: "009a21c4bc2761e58dccf07c24f219adaebe0ff707abdfd40b0a763d4003fab9" + sha256: "386ce3d9cce47838355000070b1d0b13efb5bc430f8ecda7e9238c8409ace012" url: "https://pub.dev" source: hosted - version: "4.2.2" + version: "4.2.4" geolocator_web: dependency: transitive description: @@ -476,10 +476,10 @@ packages: dependency: transitive description: name: image_picker_android - sha256: "39f2bfe497e495450c81abcd44b62f56c2a36a37a175da7d137b4454977b51b1" + sha256: "8c5abf0dcc24fe6e8e0b4a5c0b51a5cf30cefdf6407a3213dae61edc75a70f56" url: "https://pub.dev" source: hosted - version: "0.8.9+3" + version: "0.8.12+12" image_picker_for_web: dependency: transitive description: @@ -492,10 +492,10 @@ packages: dependency: transitive description: name: image_picker_ios - sha256: fadafce49e8569257a0cad56d24438a6fa1f0cbd7ee0af9b631f7492818a4ca3 + sha256: "6703696ad49f5c3c8356d576d7ace84d1faf459afb07accbb0fae780753ff447" url: "https://pub.dev" source: hosted - version: "0.8.9+1" + version: "0.8.12" image_picker_linux: dependency: transitive description: @@ -516,10 +516,10 @@ packages: dependency: transitive description: name: image_picker_platform_interface - sha256: fa4e815e6fcada50e35718727d83ba1c92f1edf95c0b4436554cec301b56233b + sha256: "9ec26d410ff46f483c5519c29c02ef0e02e13a543f882b152d4bfd2f06802f80" url: "https://pub.dev" source: hosted - version: "2.9.3" + version: "2.10.0" image_picker_windows: dependency: transitive description: @@ -540,10 +540,10 @@ packages: dependency: transitive description: name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf url: "https://pub.dev" source: hosted - version: "0.6.7" + version: "0.7.1" leak_tracker: dependency: transitive description: @@ -620,18 +620,18 @@ packages: dependency: transitive description: name: mime - sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" + sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.0.6" mime_type: dependency: transitive description: name: mime_type - sha256: "2ad6e67d3d2de9ac0f8ef5352d998fd103cb21351ae8c02fb0c78b079b37d275" + sha256: d652b613e84dac1af28030a9fba82c0999be05b98163f9e18a0849c6e63838bb url: "https://pub.dev" source: hosted - version: "1.0.0" + version: "1.0.1" nm: dependency: transitive description: @@ -660,26 +660,26 @@ packages: dependency: transitive description: name: path_provider - sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b + sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.4" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" + sha256: "6f01f8e37ec30b07bc424b4deabac37cacb1bc7e2e515ad74486039918a37eb7" url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.2.10" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" + sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.0" path_provider_linux: dependency: transitive description: @@ -700,10 +700,10 @@ packages: dependency: transitive description: name: path_provider_windows - sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.3.0" petitparser: dependency: transitive description: @@ -724,10 +724,10 @@ packages: dependency: transitive description: name: platform - sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + sha256: "9b71283fc13df574056616011fb138fd3b793ea47cc509c189a6c3fa5f8a1a65" url: "https://pub.dev" source: hosted - version: "3.1.4" + version: "3.1.5" plugin_platform_interface: dependency: transitive description: @@ -740,10 +740,10 @@ packages: dependency: transitive description: name: pointycastle - sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29" + sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe" url: "https://pub.dev" source: hosted - version: "3.7.4" + version: "3.9.1" rokwire_plugin: dependency: "direct main" description: @@ -755,58 +755,58 @@ packages: dependency: transitive description: name: shared_preferences - sha256: "81429e4481e1ccfb51ede496e916348668fd0921627779233bd24cc3ff6abd02" + sha256: "746e5369a43170c25816cc472ee016d3a66bc13fcf430c0bc41ad7b4b2922051" url: "https://pub.dev" source: hosted - version: "2.2.2" + version: "2.3.2" shared_preferences_android: dependency: transitive description: name: shared_preferences_android - sha256: "8568a389334b6e83415b6aae55378e158fbc2314e074983362d20c562780fb06" + sha256: "480ba4345773f56acda9abf5f50bd966f581dac5d514e5fc4a18c62976bbba7e" url: "https://pub.dev" source: hosted - version: "2.2.1" + version: "2.3.2" shared_preferences_foundation: dependency: transitive description: name: shared_preferences_foundation - sha256: "7708d83064f38060c7b39db12aefe449cb8cdc031d6062280087bc4cdb988f5c" + sha256: c4b35f6cb8f63c147312c054ce7c2254c8066745125264f0c88739c417fc9d9f url: "https://pub.dev" source: hosted - version: "2.3.5" + version: "2.5.2" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux - sha256: "9f2cbcf46d4270ea8be39fa156d86379077c8a5228d9dfdb1164ae0bb93f1faa" + sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.1" shared_preferences_platform_interface: dependency: transitive description: name: shared_preferences_platform_interface - sha256: "22e2ecac9419b4246d7c22bfbbda589e3acf5c0351137d87dd2939d984d37c3b" + sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.1" shared_preferences_web: dependency: transitive description: name: shared_preferences_web - sha256: "9aee1089b36bd2aafe06582b7d7817fd317ef05fc30e6ba14bff247d0933042a" + sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.4.2" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows - sha256: "841ad54f3c8381c480d0c9b508b89a34036f512482c407e6df7a9c4aa2ef8f59" + sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.4.1" sky_engine: dependency: transitive description: flutter @@ -832,18 +832,18 @@ packages: dependency: transitive description: name: sqflite - sha256: a9016f495c927cb90557c909ff26a6d92d9bd54fc42ba92e19d4e79d61e798c6 + sha256: a43e5a27235518c03ca238e7b4732cf35eabe863a369ceba6cbefa537a66f16d url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.3+1" sqflite_common: dependency: transitive description: name: sqflite_common - sha256: "28d8c66baee4968519fb8bd6cdbedad982d6e53359091f0b74544a9f32ec72d5" + sha256: "3da423ce7baf868be70e2c0976c28a1bb2f73644268b7ffa7d2e08eab71f16a4" url: "https://pub.dev" source: hosted - version: "2.5.3" + version: "2.5.4" stack_trace: dependency: transitive description: @@ -896,10 +896,10 @@ packages: dependency: transitive description: name: timezone - sha256: "1cfd8ddc2d1cfd836bc93e67b9be88c3adaeca6f40a00ca999104c30693cdca0" + sha256: "2236ec079a174ce07434e89fcd3fcda430025eb7692244139a9cf54fdcf1fc7d" url: "https://pub.dev" source: hosted - version: "0.9.2" + version: "0.9.4" typed_data: dependency: transitive description: @@ -944,10 +944,10 @@ packages: dependency: transitive description: name: url_launcher_android - sha256: d4ed0711849dd8e33eb2dd69c25db0d0d3fdc37e0a62e629fe32f57a22db2745 + sha256: f0c73347dfcfa5b3db8bc06e1502668265d39c08f310c29bff4e28eea9699f79 url: "https://pub.dev" source: hosted - version: "6.3.0" + version: "6.3.9" url_launcher_ios: dependency: transitive description: @@ -960,18 +960,18 @@ packages: dependency: transitive description: name: url_launcher_linux - sha256: ab360eb661f8879369acac07b6bb3ff09d9471155357da8443fd5d3cf7363811 + sha256: e2b9622b4007f97f504cd64c0128309dfb978ae66adbe944125ed9e1750f06af url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.2.0" url_launcher_macos: dependency: transitive description: name: url_launcher_macos - sha256: b7244901ea3cf489c5335bdacda07264a6e960b1c1b1a9f91e4bc371d9e68234 + sha256: "769549c999acdb42b8bcfa7c43d72bf79a382ca7441ab18a808e101149daf672" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "3.2.1" url_launcher_platform_interface: dependency: transitive description: @@ -984,18 +984,18 @@ packages: dependency: transitive description: name: url_launcher_web - sha256: "3692a459204a33e04bc94f5fb91158faf4f2c8903281ddd82915adecdb1a901d" + sha256: "772638d3b34c779ede05ba3d38af34657a05ac55b06279ea6edd409e323dca8e" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.3.3" url_launcher_windows: dependency: transitive description: name: url_launcher_windows - sha256: ecf9725510600aa2bb6d7ddabe16357691b6d2805f66216a97d1b881e21beff7 + sha256: "49c10f879746271804767cb45551ec5592cdab00ee105c06dddde1a98f73b185" url: "https://pub.dev" source: hosted - version: "3.1.1" + version: "3.1.2" uuid: dependency: transitive description: @@ -1024,10 +1024,10 @@ packages: dependency: transitive description: name: web - sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "1.1.0" webview_flutter: dependency: transitive description: @@ -1060,14 +1060,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.9.5" - win32: - dependency: transitive - description: - name: win32 - sha256: "464f5674532865248444b4c3daca12bd9bf2d7c47f759ce2617986e7229494a8" - url: "https://pub.dev" - source: hosted - version: "5.2.0" xdg_directories: dependency: transitive description: @@ -1085,5 +1077,5 @@ packages: source: hosted version: "6.5.0" sdks: - dart: ">=3.3.0 <4.0.0" + dart: ">=3.4.0 <4.0.0" flutter: ">=3.22.0" diff --git a/lib/model/places.dart b/lib/model/places.dart new file mode 100644 index 000000000..a0062a491 --- /dev/null +++ b/lib/model/places.dart @@ -0,0 +1,86 @@ +import 'package:flutter/cupertino.dart'; +import 'package:json_annotation/json_annotation.dart'; + +part 'places.g.dart'; + +@JsonSerializable(explicitToJson: true, fieldRename: FieldRename.snake) +class Place { + String id; + String? name; + String? address; + List? imageUrls; + String? description; + double latitude; + double longitude; + UserPlace? userData; + List? types; + List? tags; + DateTime? dateCreated; + DateTime? dateUpdated; + + Place({ + required this.id, + this.name, + this.address, + this.imageUrls, + this.description, + required this.latitude, + required this.longitude, + this.userData, + this.types, + this.tags, + this.dateCreated, + this.dateUpdated, + }); + + factory Place.fromJson(Map json) => _$PlaceFromJson(json); + + Map toJson() => _$PlaceToJson(this); + + static List? listFromJson(List? jsonList) { + List? result; + if (jsonList != null) { + result = []; + for (dynamic jsonEntry in jsonList) { + try{ + Place place = Place.fromJson(jsonEntry); + result.add(place); + } + catch(e){ + debugPrint("Error decoding places list $e"); + } + } + } + return result; + } + + static List? listToJson(List? contentList) { + List? jsonList; + if (contentList != null) { + jsonList = []; + for (dynamic contentEntry in contentList) { + jsonList.add(contentEntry?.toJson()); + } + } + return jsonList; + } +} + +@JsonSerializable(explicitToJson: true, fieldRename: FieldRename.snake) +class UserPlace { + String id; + List? visited; + DateTime? dateCreated; + DateTime? dateUpdated; + + UserPlace({ + required this.id, + this.visited, + this.dateCreated, + this.dateUpdated, + }); + + factory UserPlace.fromJson(Map json) => _$UserPlaceFromJson(json); + + Map toJson() => _$UserPlaceToJson(this); +} \ No newline at end of file diff --git a/lib/model/places.g.dart b/lib/model/places.g.dart new file mode 100644 index 000000000..666926e33 --- /dev/null +++ b/lib/model/places.g.dart @@ -0,0 +1,66 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'places.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +Place _$PlaceFromJson(Map json) => Place( + id: json['id'] as String, + name: json['name'] as String?, + address: json['address'] as String?, + imageUrls: (json['image_urls'] as List?) + ?.map((e) => e as String) + .toList(), + description: json['description'] as String?, + latitude: (json['latitude'] as num).toDouble(), + longitude: (json['longitude'] as num).toDouble(), + userData: json['user_data'] == null + ? null + : UserPlace.fromJson(json['user_data'] as Map), + types: + (json['types'] as List?)?.map((e) => e as String).toList(), + tags: (json['tags'] as List?)?.map((e) => e as String).toList(), + dateCreated: json['date_created'] == null + ? null + : DateTime.parse(json['date_created'] as String), + dateUpdated: json['date_updated'] == null + ? null + : DateTime.parse(json['date_updated'] as String), + ); + +Map _$PlaceToJson(Place instance) => { + 'id': instance.id, + 'name': instance.name, + 'address': instance.address, + 'image_urls': instance.imageUrls, + 'description': instance.description, + 'latitude': instance.latitude, + 'longitude': instance.longitude, + 'user_data': instance.userData?.toJson(), + 'types': instance.types, + 'tags': instance.tags, + 'date_created': instance.dateCreated?.toIso8601String(), + 'date_updated': instance.dateUpdated?.toIso8601String(), + }; + +UserPlace _$UserPlaceFromJson(Map json) => UserPlace( + id: json['id'] as String, + visited: (json['visited'] as List?) + ?.map((e) => DateTime.parse(e as String)) + .toList(), + dateCreated: json['date_created'] == null + ? null + : DateTime.parse(json['date_created'] as String), + dateUpdated: json['date_updated'] == null + ? null + : DateTime.parse(json['date_updated'] as String), + ); + +Map _$UserPlaceToJson(UserPlace instance) => { + 'id': instance.id, + 'visited': instance.visited?.map((e) => e.toIso8601String()).toList(), + 'date_created': instance.dateCreated?.toIso8601String(), + 'date_updated': instance.dateUpdated?.toIso8601String(), + }; diff --git a/lib/service/config.dart b/lib/service/config.dart index f989a1ab1..86dffcced 100644 --- a/lib/service/config.dart +++ b/lib/service/config.dart @@ -522,6 +522,7 @@ class Config with Service, NetworkAuthProvider, NotificationsListener { String? get contentUrl => JsonUtils.stringValue(platformBuildingBlocks["content_url"]); String? get calendarUrl => JsonUtils.stringValue(platformBuildingBlocks["calendar_url"]); String? get surveysUrl => JsonUtils.stringValue(platformBuildingBlocks["surveys_url"]); + String? get placesUrl => JsonUtils.stringValue(platformBuildingBlocks["places_url"]); // Getters: otherUniversityServices String? get assetsUrl => JsonUtils.stringValue(otherUniversityServices['assets_url']); diff --git a/lib/service/places.dart b/lib/service/places.dart new file mode 100644 index 000000000..45a284fa4 --- /dev/null +++ b/lib/service/places.dart @@ -0,0 +1,135 @@ +import 'dart:async'; +import 'package:flutter/material.dart'; +import 'package:rokwire_plugin/model/places.dart'; +import 'package:rokwire_plugin/utils/utils.dart'; +import 'auth2.dart'; +import 'config.dart'; +import 'network.dart'; + +class PlacesService { + static final PlacesService _instance = PlacesService._internal(); + + factory PlacesService() => _instance; + + PlacesService._internal(); + + /// Retrieves all places based on provided filters. + Future?> getAllPlaces({ + Set? ids, + Set? types, + Set? tags, + }) async { + Map queryParams = {}; + + if (ids != null && ids.isNotEmpty) queryParams['ids'] = ids.join(','); + if (types != null && types.isNotEmpty) queryParams['types'] = types.join(','); + if (tags != null && tags.isNotEmpty) queryParams['tags'] = tags.join(','); + + Uri uri; + try { + uri = Uri.parse('${Config().placesUrl}/places').replace(queryParameters: queryParams); + } catch (e) { + debugPrint('Failed to parse URI: $e'); + return null; + } + + try { + final response = await Network().get(uri.toString(), auth: Auth2()); + + if (response?.statusCode == 200) { + List? jsonList = JsonUtils.decodeList(response?.body); + if (jsonList != null) { + try { + return Place.listFromJson(jsonList); + } catch (e) { + debugPrint('Failed to parse places: $e'); + return null; + } + } else { + debugPrint('Failed to decode places list'); + return null; + } + } else { + debugPrint('Failed to load places: ${response?.statusCode} ${response?.body}'); + return null; + } + } catch (e) { + debugPrint('Network error while fetching places: $e'); + return null; + } + } + + /// Updates the 'visited' status of a place. + Future updatePlaceVisited(String id, bool visited) async { + Map queryParams = {'visited': visited.toString()}; + + Uri uri; + try { + uri = Uri.parse('${Config().placesUrl}/places/$id/visited').replace(queryParameters: queryParams); + } catch (e) { + debugPrint('Failed to parse URI: $e'); + return null; + } + + try { + final response = await Network().put( + uri.toString(), + headers: {'Content-Type': 'application/json'}, + auth: Auth2(), + ); + + if (response?.statusCode == 200) { + Map? jsonMap = JsonUtils.decodeMap(response?.body); + if (jsonMap != null) { + try { + return Place.fromJson(jsonMap); + } catch (e) { + debugPrint('Failed to parse place from JSON: $e'); + return null; + } + } else { + debugPrint('Failed to decode response body'); + return null; + } + } else { + debugPrint('Failed to update place visited status: ${response?.statusCode} ${response?.body}'); + return null; + } + } catch (e) { + debugPrint('Network error while updating place visited status: $e'); + return null; + } + } + + /// Deletes a visited place record. + Future deleteVisitedPlace(String id, DateTime visited) async { + Map queryParams = { + 'visited': visited.toIso8601String(), + }; + + Uri uri; + try { + uri = Uri.parse('${Config().placesUrl}/places/$id/visited').replace(queryParameters: queryParams); + } catch (e) { + debugPrint('Failed to parse URI: $e'); + return false; + } + + try { + final response = await Network().delete( + uri.toString(), + auth: Auth2(), + ); + + if (response?.statusCode == 200) { + return true; + } else { + debugPrint('Failed to delete visited place: ${response?.statusCode} ${response?.body}'); + return false; + } + } catch (e) { + debugPrint('Network error while deleting visited place: $e'); + return false; + } + } +} \ No newline at end of file diff --git a/pubspec.yaml b/pubspec.yaml index e3c4e7700..759a202dd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -55,11 +55,13 @@ dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^1.0.0 + json_serializable: ^6.8.0 + build_runner: ^2.4.11 # comment the override below if published plugin is used -dependency_overrides: - font_awesome_flutter: - path: plugins/font_awesome_flutter +#dependency_overrides: +# font_awesome_flutter: +# path: plugins/font_awesome_flutter # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec From 5ba5b81b7d1a034a319b18e1bf6ed8e5190b0079 Mon Sep 17 00:00:00 2001 From: manavmodi Date: Wed, 2 Oct 2024 15:36:56 -0500 Subject: [PATCH 2/5] Updating the model based on building block --- lib/model/places.dart | 32 ++++++++++++++++++++++++-------- lib/model/places.g.dart | 18 +++++++++++++++--- 2 files changed, 39 insertions(+), 11 deletions(-) diff --git a/lib/model/places.dart b/lib/model/places.dart index a0062a491..210d82ce9 100644 --- a/lib/model/places.dart +++ b/lib/model/places.dart @@ -7,8 +7,9 @@ part 'places.g.dart'; class Place { String id; String? name; + String? subtitle; String? address; - List? imageUrls; + List? images; String? description; double latitude; double longitude; @@ -21,8 +22,9 @@ class Place { Place({ required this.id, this.name, + this.subtitle, this.address, - this.imageUrls, + this.images, this.description, required this.latitude, required this.longitude, @@ -42,11 +44,10 @@ class Place { if (jsonList != null) { result = []; for (dynamic jsonEntry in jsonList) { - try{ + try { Place place = Place.fromJson(jsonEntry); result.add(place); - } - catch(e){ + } catch (e) { debugPrint("Error decoding places list $e"); } } @@ -58,8 +59,8 @@ class Place { List? jsonList; if (contentList != null) { jsonList = []; - for (dynamic contentEntry in contentList) { - jsonList.add(contentEntry?.toJson()); + for (Place contentEntry in contentList) { + jsonList.add(contentEntry.toJson()); } } return jsonList; @@ -83,4 +84,19 @@ class UserPlace { factory UserPlace.fromJson(Map json) => _$UserPlaceFromJson(json); Map toJson() => _$UserPlaceToJson(this); -} \ No newline at end of file +} + +@JsonSerializable(explicitToJson: true, fieldRename: FieldRename.snake) +class Image { + String imageUrl; + String? caption; + + Image({ + required this.imageUrl, + this.caption, + }); + + factory Image.fromJson(Map json) => _$ImageFromJson(json); + + Map toJson() => _$ImageToJson(this); +} diff --git a/lib/model/places.g.dart b/lib/model/places.g.dart index 666926e33..515c48e93 100644 --- a/lib/model/places.g.dart +++ b/lib/model/places.g.dart @@ -9,9 +9,10 @@ part of 'places.dart'; Place _$PlaceFromJson(Map json) => Place( id: json['id'] as String, name: json['name'] as String?, + subtitle: json['subtitle'] as String?, address: json['address'] as String?, - imageUrls: (json['image_urls'] as List?) - ?.map((e) => e as String) + images: (json['images'] as List?) + ?.map((e) => Image.fromJson(e as Map)) .toList(), description: json['description'] as String?, latitude: (json['latitude'] as num).toDouble(), @@ -33,8 +34,9 @@ Place _$PlaceFromJson(Map json) => Place( Map _$PlaceToJson(Place instance) => { 'id': instance.id, 'name': instance.name, + 'subtitle': instance.subtitle, 'address': instance.address, - 'image_urls': instance.imageUrls, + 'images': instance.images?.map((e) => e.toJson()).toList(), 'description': instance.description, 'latitude': instance.latitude, 'longitude': instance.longitude, @@ -64,3 +66,13 @@ Map _$UserPlaceToJson(UserPlace instance) => { 'date_created': instance.dateCreated?.toIso8601String(), 'date_updated': instance.dateUpdated?.toIso8601String(), }; + +Image _$ImageFromJson(Map json) => Image( + imageUrl: json['image_url'] as String, + caption: json['caption'] as String?, + ); + +Map _$ImageToJson(Image instance) => { + 'image_url': instance.imageUrl, + 'caption': instance.caption, + }; From 98eeea295639fc15325d4fd4529b1c4d0bde294f Mon Sep 17 00:00:00 2001 From: manavmodi Date: Mon, 7 Oct 2024 17:06:24 -0400 Subject: [PATCH 3/5] Updated changes to the model and service based on building block --- lib/model/places.dart | 2 +- lib/model/places.g.dart | 4 ++-- lib/service/places.dart | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/model/places.dart b/lib/model/places.dart index 210d82ce9..a6ecf59ee 100644 --- a/lib/model/places.dart +++ b/lib/model/places.dart @@ -70,7 +70,7 @@ class Place { @JsonSerializable(explicitToJson: true, fieldRename: FieldRename.snake) class UserPlace { String id; - List? visited; + List? visited; DateTime? dateCreated; DateTime? dateUpdated; diff --git a/lib/model/places.g.dart b/lib/model/places.g.dart index 515c48e93..8f06094f8 100644 --- a/lib/model/places.g.dart +++ b/lib/model/places.g.dart @@ -50,7 +50,7 @@ Map _$PlaceToJson(Place instance) => { UserPlace _$UserPlaceFromJson(Map json) => UserPlace( id: json['id'] as String, visited: (json['visited'] as List?) - ?.map((e) => DateTime.parse(e as String)) + ?.map((e) => e == null ? null : DateTime.parse(e as String)) .toList(), dateCreated: json['date_created'] == null ? null @@ -62,7 +62,7 @@ UserPlace _$UserPlaceFromJson(Map json) => UserPlace( Map _$UserPlaceToJson(UserPlace instance) => { 'id': instance.id, - 'visited': instance.visited?.map((e) => e.toIso8601String()).toList(), + 'visited': instance.visited?.map((e) => e?.toIso8601String()).toList(), 'date_created': instance.dateCreated?.toIso8601String(), 'date_updated': instance.dateUpdated?.toIso8601String(), }; diff --git a/lib/service/places.dart b/lib/service/places.dart index 45a284fa4..b9f89906e 100644 --- a/lib/service/places.dart +++ b/lib/service/places.dart @@ -60,7 +60,7 @@ class PlacesService { } /// Updates the 'visited' status of a place. - Future updatePlaceVisited(String id, bool visited) async { + Future updatePlaceVisited(String id, bool visited) async { Map queryParams = {'visited': visited.toString()}; Uri uri; @@ -82,7 +82,7 @@ class PlacesService { Map? jsonMap = JsonUtils.decodeMap(response?.body); if (jsonMap != null) { try { - return Place.fromJson(jsonMap); + return UserPlace.fromJson(jsonMap); } catch (e) { debugPrint('Failed to parse place from JSON: $e'); return null; From 3b0b9acf2196ebc1e0b2b4ffad2a8ad583c45e43 Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Tue, 8 Oct 2024 09:45:01 +0300 Subject: [PATCH 4/5] Included json_annotation package in pubspec.yaml [#475]. --- example/pubspec.lock | 8 ++++++++ pubspec.yaml | 1 + 2 files changed, 9 insertions(+) diff --git a/example/pubspec.lock b/example/pubspec.lock index 6056734cb..4465dde2a 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -544,6 +544,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.1" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + url: "https://pub.dev" + source: hosted + version: "4.9.0" leak_tracker: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 759a202dd..faa43147c 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -44,6 +44,7 @@ dependencies: # font_awesome_flutter: ^10.6.0 # published plugin - uncomment if used font_awesome_flutter: '>= 4.7.0' # comment if published plugin is used pinch_zoom: ^1.0.0 + json_annotation: ^4.9.0 #Firebase firebase_core: ^3.2.0 From 0fd12b4bf85348f3f582e2d7e336edbd8f9630b9 Mon Sep 17 00:00:00 2001 From: Mihail Varbanov Date: Tue, 8 Oct 2024 10:26:58 +0300 Subject: [PATCH 5/5] PlacesService is renamed to Places in order to follow the current naming convention for services [#475]. --- lib/service/places.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/service/places.dart b/lib/service/places.dart index b9f89906e..f1aab28fa 100644 --- a/lib/service/places.dart +++ b/lib/service/places.dart @@ -6,12 +6,12 @@ import 'auth2.dart'; import 'config.dart'; import 'network.dart'; -class PlacesService { - static final PlacesService _instance = PlacesService._internal(); +class Places { + static final Places _instance = Places._internal(); - factory PlacesService() => _instance; + factory Places() => _instance; - PlacesService._internal(); + Places._internal(); /// Retrieves all places based on provided filters. Future?> getAllPlaces({