Skip to content

Commit c82908b

Browse files
committed
Enabling ability to use a Map<String,String> for query parameters instead of appending to url.
1 parent f738221 commit c82908b

File tree

13 files changed

+190
-107
lines changed

13 files changed

+190
-107
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Changelog
2+
3+
## 0.1.0
4+
5+
* Added: Documentation for the example.
6+
17
## 0.0.3
28

39
* Added: Documentation for the example.

example/ios/Podfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
55
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
66

7+
install! 'cocoapods', :disable_input_output_paths => true
8+
79
project 'Runner', {
810
'Debug' => :debug,
911
'Profile' => :release,

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
1212
3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
1313
3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
14+
3BF671573F6DDF22BE1013F7 /* libPods-Runner.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C5E8C8FB27501C433EA495FA /* libPods-Runner.a */; };
1415
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
1516
9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
1617
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
@@ -37,13 +38,16 @@
3738
/* End PBXCopyFilesBuildPhase section */
3839

3940
/* Begin PBXFileReference section */
41+
126FE52FDFC1BDF665A063F7 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
4042
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
4143
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
44+
23AE0DDE919024A71E32D59E /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
4245
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
4346
3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = "<group>"; };
4447
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
4548
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
4649
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
50+
8AE106199467C91CFDB141F3 /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
4751
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
4852
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
4953
9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = "<group>"; };
@@ -53,6 +57,7 @@
5357
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
5458
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
5559
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
60+
C5E8C8FB27501C433EA495FA /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; };
5661
/* End PBXFileReference section */
5762

5863
/* Begin PBXFrameworksBuildPhase section */
@@ -62,6 +67,7 @@
6267
files = (
6368
9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
6469
3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
70+
3BF671573F6DDF22BE1013F7 /* libPods-Runner.a in Frameworks */,
6571
);
6672
runOnlyForDeploymentPostprocessing = 0;
6773
};
@@ -87,7 +93,8 @@
8793
9740EEB11CF90186004384FC /* Flutter */,
8894
97C146F01CF9000F007C117D /* Runner */,
8995
97C146EF1CF9000F007C117D /* Products */,
90-
CF3B75C9A7D2FA2A4C99F110 /* Frameworks */,
96+
C5C6273DF2640D363291C0BB /* Pods */,
97+
DEDC890A64E743B55DDEB300 /* Frameworks */,
9198
);
9299
sourceTree = "<group>";
93100
};
@@ -123,19 +130,40 @@
123130
name = "Supporting Files";
124131
sourceTree = "<group>";
125132
};
133+
C5C6273DF2640D363291C0BB /* Pods */ = {
134+
isa = PBXGroup;
135+
children = (
136+
126FE52FDFC1BDF665A063F7 /* Pods-Runner.debug.xcconfig */,
137+
23AE0DDE919024A71E32D59E /* Pods-Runner.release.xcconfig */,
138+
8AE106199467C91CFDB141F3 /* Pods-Runner.profile.xcconfig */,
139+
);
140+
name = Pods;
141+
path = Pods;
142+
sourceTree = "<group>";
143+
};
144+
DEDC890A64E743B55DDEB300 /* Frameworks */ = {
145+
isa = PBXGroup;
146+
children = (
147+
C5E8C8FB27501C433EA495FA /* libPods-Runner.a */,
148+
);
149+
name = Frameworks;
150+
sourceTree = "<group>";
151+
};
126152
/* End PBXGroup section */
127153

128154
/* Begin PBXNativeTarget section */
129155
97C146ED1CF9000F007C117D /* Runner */ = {
130156
isa = PBXNativeTarget;
131157
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
132158
buildPhases = (
159+
E6596CFD0A8AB4410DCC306C /* [CP] Check Pods Manifest.lock */,
133160
9740EEB61CF901F6004384FC /* Run Script */,
134161
97C146EA1CF9000F007C117D /* Sources */,
135162
97C146EB1CF9000F007C117D /* Frameworks */,
136163
97C146EC1CF9000F007C117D /* Resources */,
137164
9705A1C41CF9048500538489 /* Embed Frameworks */,
138165
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
166+
76A4C1EFEA83707C69CAB4E4 /* [CP] Embed Pods Frameworks */,
139167
);
140168
buildRules = (
141169
);
@@ -208,6 +236,25 @@
208236
shellPath = /bin/sh;
209237
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
210238
};
239+
76A4C1EFEA83707C69CAB4E4 /* [CP] Embed Pods Frameworks */ = {
240+
isa = PBXShellScriptBuildPhase;
241+
buildActionMask = 2147483647;
242+
files = (
243+
);
244+
inputFileListPaths = (
245+
);
246+
inputPaths = (
247+
);
248+
name = "[CP] Embed Pods Frameworks";
249+
outputFileListPaths = (
250+
);
251+
outputPaths = (
252+
);
253+
runOnlyForDeploymentPostprocessing = 0;
254+
shellPath = /bin/sh;
255+
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
256+
showEnvVarsInLog = 0;
257+
};
211258
9740EEB61CF901F6004384FC /* Run Script */ = {
212259
isa = PBXShellScriptBuildPhase;
213260
buildActionMask = 2147483647;
@@ -222,6 +269,28 @@
222269
shellPath = /bin/sh;
223270
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
224271
};
272+
E6596CFD0A8AB4410DCC306C /* [CP] Check Pods Manifest.lock */ = {
273+
isa = PBXShellScriptBuildPhase;
274+
buildActionMask = 2147483647;
275+
files = (
276+
);
277+
inputFileListPaths = (
278+
);
279+
inputPaths = (
280+
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
281+
"${PODS_ROOT}/Manifest.lock",
282+
);
283+
name = "[CP] Check Pods Manifest.lock";
284+
outputFileListPaths = (
285+
);
286+
outputPaths = (
287+
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
288+
);
289+
runOnlyForDeploymentPostprocessing = 0;
290+
shellPath = /bin/sh;
291+
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
292+
showEnvVarsInLog = 0;
293+
};
225294
/* End PBXShellScriptBuildPhase section */
226295

227296
/* Begin PBXSourcesBuildPhase section */

example/ios/Runner.xcworkspace/contents.xcworkspacedata

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

example/lib/credentials.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
// Replace this if you are going to run the example. You can get your own at https://openweathermap.org/
2-
const String OPEN_WEATHER_API_KEY = "YOUR-KEY-GOES-HERE";
2+
const String OPEN_WEATHER_API_KEY = "b04a4a7c5a71de47d7cdb0c7607c5d14";

example/lib/main.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -161,12 +161,10 @@ class WeatherSearch extends SearchDelegate<String> {
161161
mainAxisSize: MainAxisSize.min,
162162
children: <Widget>[
163163
ListTile(
164-
leading: Column(
165-
children: <Widget>[
166-
Image.network(
167-
"https://openweathermap.org/img/w/$iconWeather.png"),
168-
Text(weather["weather"][0]["main"]),
169-
],
164+
leading: Tooltip(
165+
child: Image.network(
166+
"https://openweathermap.org/img/w/$iconWeather.png"),
167+
message: weather["weather"][0]["main"],
170168
),
171169
title: Text(city["name"]),
172170
subtitle: Text(city["country"]),
@@ -233,7 +231,7 @@ class WeatherSearch extends SearchDelegate<String> {
233231
const baseUrl = "https://api.openweathermap.org/data/2.5";
234232

235233
class WeatherRepository {
236-
Client client;
234+
HttpClientWithInterceptor client;
237235

238236
WeatherRepository(this.client);
239237

@@ -244,7 +242,7 @@ class WeatherRepository {
244242
// try {
245243
// var response = await HttpWithInterceptor.build(
246244
// interceptors: [WeatherApiInterceptor()])
247-
// .get("$baseUrl/weather?id=$id");
245+
// .get("$baseUrl/weather", params: {'id': "$id"});
248246
// if (response.statusCode == 200) {
249247
// parsedWeather = json.decode(response.body);
250248
// } else {
@@ -259,7 +257,9 @@ class WeatherRepository {
259257
Future<Map<String, dynamic>> fetchCityWeather(int id) async {
260258
var parsedWeather;
261259
try {
262-
final response = await client.get("$baseUrl/weather?id=$id");
260+
final response = await client.get("$baseUrl/weather", params: {
261+
'id': "$id",
262+
});
263263
if (response.statusCode == 200) {
264264
parsedWeather = json.decode(response.body);
265265
} else {
@@ -276,8 +276,8 @@ class WeatherApiInterceptor implements InterceptorContract {
276276
@override
277277
Future<RequestData> interceptRequest({RequestData data}) async {
278278
try {
279-
data.url = "${data.url}&appid=$OPEN_WEATHER_API_KEY";
280-
data.url = "${data.url}&units=metric";
279+
data.params['appid'] = OPEN_WEATHER_API_KEY;
280+
data.params['units'] = 'metric';
281281
data.headers["Content-Type"] = "application/json";
282282
} catch (e) {
283283
print(e);

example/pubspec.lock

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# Generated by pub
2-
# See https://www.dartlang.org/tools/pub/glossary#lockfile
2+
# See https://dart.dev/tools/pub/glossary#lockfile
33
packages:
44
async:
55
dependency: transitive
66
description:
77
name: async
88
url: "https://pub.dartlang.org"
99
source: hosted
10-
version: "2.0.8"
10+
version: "2.3.0"
1111
boolean_selector:
1212
dependency: transitive
1313
description:
1414
name: boolean_selector
1515
url: "https://pub.dartlang.org"
1616
source: hosted
17-
version: "1.0.4"
17+
version: "1.0.5"
1818
charcode:
1919
dependency: transitive
2020
description:
@@ -59,7 +59,7 @@ packages:
5959
path: ".."
6060
relative: true
6161
source: path
62-
version: "0.0.3"
62+
version: "0.1.0"
6363
http_parser:
6464
dependency: transitive
6565
description:
@@ -73,35 +73,35 @@ packages:
7373
name: matcher
7474
url: "https://pub.dartlang.org"
7575
source: hosted
76-
version: "0.12.3+1"
76+
version: "0.12.5"
7777
meta:
7878
dependency: transitive
7979
description:
8080
name: meta
8181
url: "https://pub.dartlang.org"
8282
source: hosted
83-
version: "1.1.6"
83+
version: "1.1.7"
8484
path:
8585
dependency: transitive
8686
description:
8787
name: path
8888
url: "https://pub.dartlang.org"
8989
source: hosted
90-
version: "1.6.2"
90+
version: "1.6.4"
9191
pedantic:
9292
dependency: transitive
9393
description:
9494
name: pedantic
9595
url: "https://pub.dartlang.org"
9696
source: hosted
97-
version: "1.4.0"
97+
version: "1.8.0+1"
9898
quiver:
9999
dependency: transitive
100100
description:
101101
name: quiver
102102
url: "https://pub.dartlang.org"
103103
source: hosted
104-
version: "2.0.1"
104+
version: "2.0.5"
105105
sky_engine:
106106
dependency: transitive
107107
description: flutter
@@ -113,7 +113,7 @@ packages:
113113
name: source_span
114114
url: "https://pub.dartlang.org"
115115
source: hosted
116-
version: "1.5.4"
116+
version: "1.5.5"
117117
stack_trace:
118118
dependency: transitive
119119
description:
@@ -127,14 +127,14 @@ packages:
127127
name: stream_channel
128128
url: "https://pub.dartlang.org"
129129
source: hosted
130-
version: "1.6.8"
130+
version: "2.0.0"
131131
string_scanner:
132132
dependency: transitive
133133
description:
134134
name: string_scanner
135135
url: "https://pub.dartlang.org"
136136
source: hosted
137-
version: "1.0.4"
137+
version: "1.0.5"
138138
term_glyph:
139139
dependency: transitive
140140
description:
@@ -148,7 +148,7 @@ packages:
148148
name: test_api
149149
url: "https://pub.dartlang.org"
150150
source: hosted
151-
version: "0.2.2"
151+
version: "0.2.5"
152152
typed_data:
153153
dependency: transitive
154154
description:
@@ -164,4 +164,4 @@ packages:
164164
source: hosted
165165
version: "2.0.8"
166166
sdks:
167-
dart: ">=2.1.0 <3.0.0"
167+
dart: ">=2.2.2 <3.0.0"

0 commit comments

Comments
 (0)