質問編集履歴
5
誤字の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -262,9 +262,7 @@
|
|
262
262
|
|
263
263
|
http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topfreeapplications/cc=us/limit=200/json
|
264
264
|
|
265
|
-
のページを眺めたところ、"entry"が、"results"に当たりそうなので、その部分を変更し、rankingDataに"entry"の値を代入することができました。しかし、その後がうまくいきません。
|
265
|
+
のページを眺めたところ、"entry"が、"results"に当たりそうなので、その部分を変更し、rankingDataに"entry"の値を代入することができました。しかし、その後がうまくいきません。
|
266
|
-
|
267
|
-
https://github.com/phi7/app_ranking/blob/main/lib/ranking_page.dart
|
268
266
|
|
269
267
|
|
270
268
|
|
4
URLを新しいものに変更し、###試したことに「追記②」をつけました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -244,22 +244,130 @@
|
|
244
244
|
|
245
245
|
|
246
246
|
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
f
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
f
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
247
|
+
追記②
|
248
|
+
|
249
|
+
おっしゃるとおり、urlの最後をxmlからjsonに変えたところ、
|
250
|
+
|
251
|
+
feedData = data["feed"];
|
252
|
+
|
253
|
+
print(feedData);
|
254
|
+
|
255
|
+
までデータをとることができました。しかし、もとのコードとデータの取得先が違うのか"results"という項目がないためか、
|
256
|
+
|
257
|
+
rankingData = feedData["results"];
|
258
|
+
|
259
|
+
はうまくいきませんでした。
|
260
|
+
|
261
|
+
そこで、取得したurl
|
262
|
+
|
263
|
+
http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topfreeapplications/cc=us/limit=200/json
|
264
|
+
|
265
|
+
のページを眺めたところ、"entry"が、"results"に当たりそうなので、その部分を変更し、rankingDataに"entry"の値を代入することができました。しかし、その後がうまくいきません。もはや、この部分だけの問題ではなさそうなので以下にgithubを載せます。
|
266
|
+
|
267
|
+
https://github.com/phi7/app_ranking/blob/main/lib/ranking_page.dart
|
268
|
+
|
269
|
+
|
270
|
+
|
271
|
+
エラー内容
|
272
|
+
|
273
|
+
```console
|
274
|
+
|
275
|
+
flutter: us
|
276
|
+
|
277
|
+
flutter: http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topfreeapplications/cc=us/limit=200/json
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
======== Exception caught by widgets library =======================================================
|
282
|
+
|
283
|
+
The following _TypeError was thrown building RankingPage(dirty, state: _RankingPageState#5f572):
|
284
|
+
|
285
|
+
type 'Null' is not a subtype of type 'String'
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
The relevant error-causing widget was:
|
290
|
+
|
291
|
+
RankingPage file:///Users/nt/StudioProjects/app_ranking/lib/main.dart:18:13
|
292
|
+
|
293
|
+
When the exception was thrown, this was the stack:
|
294
|
+
|
295
|
+
#0 _RankingPageState.build (package:app_ranking/ranking_page.dart:177:44)
|
296
|
+
|
297
|
+
#1 StatefulElement.build (package:flutter/src/widgets/framework.dart:4691:27)
|
298
|
+
|
299
|
+
#2 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4574:15)
|
300
|
+
|
301
|
+
#3 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4746:11)
|
302
|
+
|
303
|
+
#4 Element.rebuild (package:flutter/src/widgets/framework.dart:4267:5)
|
304
|
+
|
305
|
+
...
|
306
|
+
|
307
|
+
====================================================================================================
|
308
|
+
|
309
|
+
flutter: Instance of 'Response'
|
310
|
+
|
311
|
+
flutter: {"feed":{"author":{"name":{"label":"iTunes Store"}, "uri":{"label":"http://www.apple.com/itunes/"}}, "entry":[
|
312
|
+
|
313
|
+
{"im:name":{"label":"TikTok"}, "im:image":[
|
314
|
+
|
315
|
+
{"label":"https://is2-ssl.mzstatic.com/image/thumb/Purple125/v4/d5/f8/3e/d5f83ec1-8903-ba99-2605-ddc4ce0ecd51/AppIcon_TikTok-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/53x53bb.png", "attributes":{"height":"53"}},
|
316
|
+
|
317
|
+
{"label":"https://is1-ssl.mzstatic.com/image/thumb/Purple125/v4/d5/f8/3e/d5f83ec1-8903-ba99-2605-ddc4ce0ecd51/AppIcon_TikTok-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/75x75bb.png", "attributes":{"height":"75"}},
|
318
|
+
|
319
|
+
{"label":"https://is3-ssl.mzstatic.com/image/thumb/Purple125/v4/d5/f8/3e/d5f83ec1-8903-ba99-2605-ddc4ce0ecd51/AppIcon_TikTok-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/100x100bb.png", "attributes":{"height":"100"}}], "summary":{"label":"TikTok is THE destination for mobile videos. On TikTok, short-form video<…>
|
320
|
+
|
321
|
+
flutter: 200
|
322
|
+
|
323
|
+
flutter: {feed: {author: {name: {label: iTunes Store}, uri: {label: http://www.apple.com/itunes/}}, entry: [{im:name: {label: TikTok}, im:image: [{label: https://is2-ssl.mzstatic.com/image/thumb/Purple125/v4/d5/f8/3e/d5f83ec1-8903-ba99-2605-ddc4ce0ecd51/AppIcon_TikTok-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/53x53bb.png, attributes: {height: 53}}, {label: https://is1-ssl.mzstatic.com/image/thumb/Purple125/v4/d5/f8/3e/d5f83ec1-8903-ba99-2605-ddc4ce0ecd51/AppIcon_TikTok-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/75x75bb.png, attributes: {height: 75}}, {label: https://is3-ssl.mzstatic.com/image/thumb/Purple125/v4/d5/f8/3e/d5f83ec1-8903-ba99-2605-ddc4ce0ecd51/AppIcon_TikTok-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/100x100bb.png, attributes: {height: 100}}], summary: {label: TikTok is THE destination for mobile videos. On TikTok, short-form videos are exciting, spontaneous, and genuine. Wh<…>
|
324
|
+
|
325
|
+
flutter: {author: {name: {label: iTunes Store}, uri: {label: http://www.apple.com/itunes/}}, entry: [{im:name: {label: TikTok}, im:image: [{label: https://is2-ssl.mzstatic.com/image/thumb/Purple125/v4/d5/f8/3e/d5f83ec1-8903-ba99-2605-ddc4ce0ecd51/AppIcon_TikTok-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/53x53bb.png, attributes: {height: 53}}, {label: https://is1-ssl.mzstatic.com/image/thumb/Purple125/v4/d5/f8/3e/d5f83ec1-8903-ba99-2605-ddc4ce0ecd51/AppIcon_TikTok-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/75x75bb.png, attributes: {height: 75}}, {label: https://is3-ssl.mzstatic.com/image/thumb/Purple125/v4/d5/f8/3e/d5f83ec1-8903-ba99-2605-ddc4ce0ecd51/AppIcon_TikTok-0-0-1x_U007emarketing-0-0-0-7-0-0-sRGB-0-0-0-GLES2_U002c0-512MB-85-220-0-0.png/100x100bb.png, attributes: {height: 100}}], summary: {label: TikTok is THE destination for mobile videos. On TikTok, short-form videos are exciting, spontaneous, and genuine. Whether y<…>
|
326
|
+
|
327
|
+
flutter: null
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
======== Exception caught by widgets library =======================================================
|
332
|
+
|
333
|
+
The following _TypeError was thrown building RankingPage(dirty, state: _RankingPageState#5f572):
|
334
|
+
|
335
|
+
type 'Null' is not a subtype of type 'String'
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
The relevant error-causing widget was:
|
340
|
+
|
341
|
+
RankingPage file:///Users/nt/StudioProjects/app_ranking/lib/main.dart:18:13
|
342
|
+
|
343
|
+
When the exception was thrown, this was the stack:
|
344
|
+
|
345
|
+
#0 _RankingPageState.build (package:app_ranking/ranking_page.dart:177:44)
|
346
|
+
|
347
|
+
#1 StatefulElement.build (package:flutter/src/widgets/framework.dart:4691:27)
|
348
|
+
|
349
|
+
#2 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4574:15)
|
350
|
+
|
351
|
+
#3 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4746:11)
|
352
|
+
|
353
|
+
#4 Element.rebuild (package:flutter/src/widgets/framework.dart:4267:5)
|
354
|
+
|
355
|
+
...
|
356
|
+
|
357
|
+
====================================================================================================
|
358
|
+
|
359
|
+
Lost connection to device.
|
360
|
+
|
361
|
+
```
|
362
|
+
|
363
|
+
|
364
|
+
|
365
|
+
また、urlにcc="国名"を入れることで、各国のランキングがとれるようになるかと思いきや、どれも変わりませんでした。
|
366
|
+
|
367
|
+
http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topfreeapplications/limit=200/json
|
368
|
+
|
369
|
+
http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topfreeapplications/cc=us/limit=200/json
|
370
|
+
|
371
|
+
http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topfreeapplications/cc=jp/limit=200/json
|
372
|
+
|
373
|
+
データの取得方法と、各国のランキングのurlの発見方法についてご存知の方が教えていただけると嬉しいです。
|
3
teminal→console
test
CHANGED
File without changes
|
test
CHANGED
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
|
26
26
|
|
27
|
-
### print関数で
|
27
|
+
### print関数でconsoleに出力されたもの
|
28
28
|
|
29
29
|
|
30
30
|
|
@@ -194,7 +194,7 @@
|
|
194
194
|
|
195
195
|
|
196
196
|
|
197
|
-
```
|
197
|
+
```console
|
198
198
|
|
199
199
|
flutter: us
|
200
200
|
|
2
teminalの書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -194,7 +194,7 @@
|
|
194
194
|
|
195
195
|
|
196
196
|
|
197
|
-
|
197
|
+
```teminal
|
198
198
|
|
199
199
|
flutter: us
|
200
200
|
|
@@ -230,6 +230,8 @@
|
|
230
230
|
|
231
231
|
|
232
232
|
|
233
|
+
```
|
234
|
+
|
233
235
|
とエラーがでるようになりました、、、
|
234
236
|
|
235
237
|
取得したurlのページを開くと頭に
|
1
URLを新しいものに変更し、###試したことに「追記」をつけました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -158,6 +158,90 @@
|
|
158
158
|
|
159
159
|
|
160
160
|
|
161
|
+
追記
|
162
|
+
|
163
|
+
おっしゃるとおりでURLが変わっていたようなので、新しいURLで試してみました。
|
164
|
+
|
165
|
+
(初期値は currentCode = 'us';
|
166
|
+
|
167
|
+
currentType = 'topfree';
|
168
|
+
|
169
|
+
currentGenre = 'applications';に)
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
```dart
|
174
|
+
|
175
|
+
String? currentTypeAndGenre = "$currentType$currentGenre";
|
176
|
+
|
177
|
+
var url = Uri.parse(
|
178
|
+
|
179
|
+
"http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/$currentTypeAndGenre/cc=$currentCode/limit=200/xml");
|
180
|
+
|
181
|
+
print(url);
|
182
|
+
|
183
|
+
```
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
print(url)まではteminalに出力されましたが、その後の
|
188
|
+
|
189
|
+
http.Response response = await http.get(url);
|
190
|
+
|
191
|
+
print(response);
|
192
|
+
|
193
|
+
がうまくいかないようで
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
//termial
|
198
|
+
|
199
|
+
flutter: us
|
200
|
+
|
201
|
+
flutter: http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topfreeapplications/cc=us/limit=200/xml
|
202
|
+
|
203
|
+
======== Exception caught by widgets library =======================================================
|
204
|
+
|
205
|
+
The following _TypeError was thrown building RankingPage(dirty, state: _RankingPageState#aa6a8):
|
206
|
+
|
207
|
+
type 'Null' is not a subtype of type 'String'
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
The relevant error-causing widget was:
|
212
|
+
|
213
|
+
RankingPage file:///Users/nt/StudioProjects/app_ranking/lib/main.dart:18:13
|
214
|
+
|
215
|
+
When the exception was thrown, this was the stack:
|
216
|
+
|
217
|
+
#0 _RankingPageState.build (package:app_ranking/ranking_page.dart:177:44)
|
218
|
+
|
219
|
+
#1 StatefulElement.build (package:flutter/src/widgets/framework.dart:4691:27)
|
220
|
+
|
221
|
+
#2 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4574:15)
|
222
|
+
|
223
|
+
#3 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4746:11)
|
224
|
+
|
225
|
+
#4 Element.rebuild (package:flutter/src/widgets/framework.dart:4267:5)
|
226
|
+
|
227
|
+
...
|
228
|
+
|
229
|
+
====================================================================================================
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
とエラーがでるようになりました、、、
|
234
|
+
|
235
|
+
取得したurlのページを開くと頭に
|
236
|
+
|
237
|
+
This XML file does not appear to have any style information associated with it. The document tree is shown below.
|
238
|
+
|
239
|
+
と書いており、これが原因なのでしょうか?
|
240
|
+
|
241
|
+
なにかご存じの方がいたら教えていただけると嬉しいです。
|
242
|
+
|
243
|
+
|
244
|
+
|
161
245
|
### 補足情報(FW/ツールのバージョンなど)
|
162
246
|
|
163
247
|
dependencies:
|