Closed54

もくまっち開発 Week 16

光岡 高宏光岡 高宏

パソコンに iPhone をつないだ状態で flutter run を実行すると、
iPhone にアプリをインストールしてデバッグができるみたい

$ flutter run

Connected devices:
Pixel 6a (mobile) • 29141JEGR13921            • android-arm64  • Android 14 (API 34)
MTS PRV (mobile)  • 00008130-001958511160001C • ios            • iOS 17.3.1 21D61
Chrome (web)      • chrome                    • web-javascript • Google Chrome 123.0.6312.87

No wireless devices were found.

[1]: Pixel 6a (29141JEGR13921)
[2]: MTS PRV (00008130-001958511160001C)
[3]: Chrome (chrome)
Please choose one (or "q" to quit): 2
Launching lib/main.dart on MTS PRV in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 9Z99MR8XP3
Running pod install...                                             12.9s
Running Xcode build...                                                  
 └─Compiling, linking and signing...                        25.1s
Xcode build done.                                           60.4s
You may be prompted to give access to control Xcode. Flutter uses Xcode to run your app. If access is not allowed, you can change this through your Settings > Privacy & Security >
Automation.
[ERROR:flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm(42)] Using the Impeller rendering backend.
Installing and launching...                                        38.5s
Syncing files to device MTS PRV...                                 177ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on MTS PRV is available at: http://127.0.0.1:62127/SAotALYUIrQ=/
The Flutter DevTools debugger and profiler on MTS PRV is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:62127/SAotALYUIrQ=/

══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
The following NetworkImageLoadException was thrown resolving an image codec:
HTTP request failed, statusCode: 404,
https://storage.googleapis.com/mochmatch-3ed20.appspot.com/public/images/shops/126.JPG

When the exception was thrown, this was the stack:
#0      NetworkImage._loadAsync (package:flutter/src/painting/_network_image_io.dart:115:9)
<asynchronous suspension>
#1      MultiFrameImageStreamCompleter._handleCodecReady (package:flutter/src/painting/image_stream.dart:985:3)
<asynchronous suspension>

Image provider:
  NetworkImage("https://storage.googleapis.com/mochmatch-3ed20.appspot.com/public/images/shops/126.JPG",
  scale: 1.0)
Image key:
  NetworkImage("https://storage.googleapis.com/mochmatch-3ed20.appspot.com/public/images/shops/126.JPG",
  scale: 1.0)
════════════════════════════════════════════════════════════════════════════════════════════════════

Lost connection to device.
光岡 高宏光岡 高宏

デバッグの選択肢が出るので iPhone (2)を選択

[1]: Pixel 6a (29141JEGR13921)
[2]: MTS PRV (00008130-001958511160001C)
[3]: Chrome (chrome)
Please choose one (or "q" to quit): 2
光岡 高宏光岡 高宏

ちなみに Chrome を選ぶとめちゃくちゃエラーが出る

$ flutter run

Connected devices:
Pixel 6a (mobile) • 29141JEGR13921            • android-arm64  • Android 14 (API 34)
MTS PRV (mobile)  • 00008130-001958511160001C • ios            • iOS 17.3.1 21D61
Chrome (web)      • chrome                    • web-javascript • Google Chrome 123.0.6312.87

Checking for wireless devices...

[1]: Pixel 6a (29141JEGR13921)
[2]: MTS PRV (00008130-001958511160001C)
[3]: Chrome (chrome)
Please choose one (or "q" to quit): 3

Launching lib/main.dart on Chrome in debug mode...
../../../../.pub-cache/hosted/pub.dev/web-0.3.0/lib/src/dom/accelerometer.dart:52:45: Error: The type 'JSObject' can't be used as supertype.
class AccelerometerReadingValues implements JSObject {
                                            ^
(略)
../../../../.pub-cache/hosted/pub.dev/web-0.3.0/lib/src/helpers/events/providers.dart:621:16: Error: The method 'hasProperty' isn't defined for the class
'EventTarget'.
 - 'EventTarget' is from 'package:web/src/dom/dom.dart' ('../../../../.pub-cache/hosted/pub.dev/web-0.3.0/lib/src/dom/dom.dart').
Try correcting the name to the name of an existing method, or defining a method named 'hasProperty'.
  } else if (e.hasProperty('webkitHidden'.toJS).toDart) {
               ^^^^^^^^^^^
Waiting for connection from debug service on Chrome...             21.1s
Failed to compile application.
make: *** [debug] Error 1
光岡 高宏光岡 高宏

ログのメモ

A RenderFlex overflowed by 16 pixels on the bottom.

══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
The following assertion was thrown during layout:
A RenderFlex overflowed by 16 pixels on the bottom.

The relevant error-causing widget was:
  Column
  Column:file:///Users/nix/ghq/github.com/protoout/mochmatch/lib/pages/list_page/list_page_widget.dart:87:20

The overflowing RenderFlex has an orientation of Axis.vertical.
The edge of the RenderFlex that is overflowing has been marked in the rendering with a yellow and
black striped pattern. This is usually caused by the contents being too big for the RenderFlex.
Consider applying a flex factor (e.g. using an Expanded widget) to force the children of the
RenderFlex to fit within the available space instead of being sized to their natural size.
This is considered an error condition because it indicates that there is content that cannot be
seen. If the content is legitimately bigger than the available space, consider clipping it with a
ClipRect widget before putting it in the flex, or using a scrollable container rather than a Flex,
like a ListView.
The specific RenderFlex in question is: RenderFlex#aad68 relayoutBoundary=up24 OVERFLOWING:
  creator: Column ← Align ← ConstrainedBox ← Container ← LayoutBuilder ← DefaultTextStyle ← Align ←
    Transform ← Padding ← Container ← Stack ← ClipRect ← ⋯
  parentData: offset=Offset(0.0, 0.0) (can use size)
  constraints: BoxConstraints(0.0<=w<=400.0, 0.0<=h<=40.0)
  size: Size(400.0, 40.0)
  direction: vertical
  mainAxisAlignment: end
  mainAxisSize: max
  crossAxisAlignment: center
  verticalDirection: down
◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤◢◤
════════════════════════════════════════════════════════════════════════════════════════════════════
Could not find a set of Noto fonts to display all missing characters. Please add a font asset for the missing characters. See: https://flutter.dev/docs/cookbook/design/fonts

Another exception was thrown: [object ProgressEvent]

100 個くらい出てる

光岡 高宏光岡 高宏

Another exception was thrown: [object ProgressEvent]

は CORS のエラーのせいかも

光岡 高宏光岡 高宏

https://storage.googleapis.com/mochmatch-3ed20.appspot.com/public/images/shops/126.JPG

でエラーが出てる

══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
The following NetworkImageLoadException was thrown resolving an image codec:
HTTP request failed, statusCode: 404,
https://storage.googleapis.com/mochmatch-3ed20.appspot.com/public/images/shops/126.JPG

When the exception was thrown, this was the stack:
#0      NetworkImage._loadAsync (package:flutter/src/painting/_network_image_io.dart:115:9)
<asynchronous suspension>
#1      MultiFrameImageStreamCompleter._handleCodecReady (package:flutter/src/painting/image_stream.dart:985:3)
<asynchronous suspension>

Image provider:
  NetworkImage("https://storage.googleapis.com/mochmatch-3ed20.appspot.com/public/images/shops/126.JPG",
  scale: 1.0)
Image key:
  NetworkImage("https://storage.googleapis.com/mochmatch-3ed20.appspot.com/public/images/shops/126.JPG",
  scale: 1.0)
════════════════════════════════════════════════════════════════════════════════════════════════════
光岡 高宏光岡 高宏

さっきのエラーは消えた

$ flutter run

Launching lib/main.dart on MTS PRV in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 9Z99MR8XP3
Running Xcode build...                                                  
 └─Compiling, linking and signing...                        17.8s
Xcode build done.                                           42.9s
You may be prompted to give access to control Xcode. Flutter uses Xcode to run your app. If access is not allowed, you can change this through your Settings > Privacy & Security >
Automation.
[ERROR:flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm(42)] Using the Impeller rendering backend.
Installing and launching...                                        26.4s
Syncing files to device MTS PRV...                                 119ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on MTS PRV is available at: http://127.0.0.1:50802/xYf-2GgDtSQ=/
The Flutter DevTools debugger and profiler on MTS PRV is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:50802/xYf-2GgDtSQ=/
Lost connection to device.

次はこちら

[ERROR:flutter/shell/platform/darwin/graphics/FlutterDarwinContextMetalImpeller.mm(42)] Using the Impeller rendering backend.

光岡 高宏光岡 高宏

さっきのエラーは消えた

$ flutter run

Launching lib/main.dart on MTS PRV in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 9Z99MR8XP3
Running Xcode build...                                                  
 └─Compiling, linking and signing...                        18.4s
Xcode build done.                                           47.4s
You may be prompted to give access to control Xcode. Flutter uses Xcode to run your app. If access is not allowed, you can change this through your Settings > Privacy & Security >
Automation.
Installing and launching...                                        28.6s
Syncing files to device MTS PRV...                                 140ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on MTS PRV is available at: http://127.0.0.1:51344/5-6-CHL16KU=/
The Flutter DevTools debugger and profiler on MTS PRV is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:51344/5-6-CHL16KU=/
Lost connection to device.

これで、パッと見えるエラーは消えた

光岡 高宏光岡 高宏

ここからは地道にコードをコメントアウトして切り分けていくしかなさそう

光岡 高宏光岡 高宏

DevTools は flutter run したあとに表示される URL にアクセスすると利用できる。
見た目はこんな感じ。

光岡 高宏光岡 高宏

42 件のときの最後の 3 件

flutter: MochmatchDataRecord(reference: mochmatch_data/E9BbKL91iM7rPJUUzv0C, data: {timeframe: 2, noisiness: 2, shishaPicture: https://storage.googleapis.com/mochmatch-3ed20.appspot.com/public/images/shops/1pejx85PQhyrnyuObvU3oK4Z4XF9JKVqt.webp, instagramUrl: https://www.instagram.com/holiday_shisha/, timestamp: 2024-01-06 08:11:52.000, webSiteUrl: , softnessOfChair: 3, twitterUrl: https://twitter.com/shisha_harajuku, isClosed: false, location: LatLng(lat: 35.67061110441211, lng: 139.70542682405025), bgm: 3, friendlinessOfStaffs: 4, brightness: 3, dayOfWeek: 2, name: 原宿のシーシャハウスHoliday(ホリデー)})
flutter: MochmatchDataRecord(reference: mochmatch_data/n4zyKpjdLN3eHNaivOHi, data: {timeframe: 2, noisiness: 1, shishaPicture: https://storage.googleapis.com/mochmatch-3ed20.appspot.com/public/images/shops/default.png, instagramUrl: https://www.instagram.com/holiday_shisha/, timestamp: 2023-08-31 03:27:49.000, webSiteUrl: , softnessOfChair: 3, twitterUrl: https://twitter.com/shisha_harajuku, isClosed: false, location: LatLng(lat: 35.67061110441211, lng: 139.70542682405025), bgm: 2, friendlinessOfStaffs: 4, brightness: 3, dayOfWeek: 1, name: 原宿のシーシャハウスHoliday(ホリデー)})
flutter: MochmatchDataRecord(reference: mochmatch_data/pFbdR1LFzEVD4vgLerCQ, data: {timeframe: 3, noisiness: 2, shishaPicture: https://storage.googleapis.com/mochmatch-3ed20.appspot.com/public/images/shops/17aBwJkYddrzSUc2AezG5uOoMuwjOij5V.webp, instagramUrl: https://www.instagram.com/holiday_shisha/, timestamp: 2023-12-30 11:15:01.000, webSiteUrl: , softnessOfChair: 3, twitterUrl: https://twitter.com/shisha_harajuku, isClosed: false, location: LatLng(lat: 35.67061110441211, lng: 139.70542682405025), bgm: 2, friendlinessOfStaffs: 4, brightness: 3, dayOfWeek: 2, name: 原宿のシーシャハウスHoliday(ホリデー)})
光岡 高宏光岡 高宏

43 件目

flutter: MochmatchDataRecord(reference: mochmatch_data/Vw5k8YrLUlHFtcQd5Qp5, data: {timeframe: 3, noisiness: 1, shishaPicture: https://storage.googleapis.com/mochmatch-3ed20.appspot.com/public/images/shops/129.JPG, instagramUrl: https://www.instagram.com/hellohello_ginza/, timestamp: 2024-02-29 21:05:55.061, webSiteUrl: , softnessOfChair: 3, twitterUrl: https://twitter.com/hello_stand, isClosed: false, location: LatLng(lat: 35.671652452245496, lng: 139.76100582587736), bgm: 2, friendlinessOfStaffs: 4, brightness: 1, dayOfWeek: 1, name: 銀座HelloHello STAND(ハロハロ スタンド)})
光岡 高宏光岡 高宏

この店の画像は jpeg になってて、 5.2 MB くらいあった。
これのせいかも。

webp で一回圧縮してみる

光岡 高宏光岡 高宏

全画像 webp にしてみたけど、too much memory で落ちた。
解決せず。

光岡 高宏光岡 高宏

カスタム関数にログを追加して、どの処理で落ちてるか見てみる

光岡 高宏光岡 高宏
  • calculateMochmatch
  • calculateDistance

がめっちゃ呼ばれてることがわかったけど、落ちる原因はまだわからない

$ flutter run

Connected devices:
Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.87

Wirelessly connected devices:
MTS PRV (mobile) • 00008130-001958511160001C • ios • iOS 17.3.1 21D61

[1]: Chrome (chrome)
[2]: MTS PRV (00008130-001958511160001C)
Please choose one (or "q" to quit): 2
Launching lib/main.dart on MTS PRV in debug mode...
Automatically signing iOS for device deployment using specified development team in Xcode project: 9Z99MR8XP3
Running Xcode build...                                                  
 └─Compiling, linking and signing...                         5.7s
Xcode build done.                                           36.7s
You may be prompted to give access to control Xcode. Flutter uses Xcode to run your app. If access is not allowed, you can change this through your Settings > Privacy & Security > Automation.
Installing and launching...                                        42.5s
Syncing files to device MTS PRV...                                 147ms

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h List all available interactive commands.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).

A Dart VM Service on MTS PRV is available at: http://127.0.0.1:58325/ly5fd33ac0w=/
The Flutter DevTools debugger and profiler on MTS PRV is available at: http://127.0.0.1:9101?uri=http://127.0.0.1:58325/ly5fd33ac0w=/
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
flutter: [START]calculateMochmatch
flutter: [END  ]calculateMochmatch
flutter: [START]calculateDistance
flutter: [END  ]calculateDistance
Lost connection to device.
光岡 高宏光岡 高宏

List ページがメモリを大量に使う可能性があるか聞いてみた

Claude

はい、このコードではメモリを大量に使用する可能性があります。以下の点が原因と考えられます。

1. **FutureBuilder**
`FutureBuilder`を使って大量のデータをロードしようとしている箇所があります。大量のデータをメモリ上に保持すると、メモリ消費量が増えてしまう可能性があります。

2. **ListView.builder**
`ListView.builder`を使って大量のデータを表示しようとしています。リストの要素数が多くなればなるほど、メモリ消費量が増加します。

3. **画像データ**
各リスト要素に画像を表示しようとしています。画像データをメモリ上に保持するため、画像の数が増えるとメモリ消費量が増加します。

4. **ステートフル Widget**
`StatefulWidget`を使用しているため、ウィジェットツリー全体が再ビルドされる可能性があります。再ビルドの際にメモリを大量に消費する可能性があります。

メモリ消費を抑えるためには、以下の対策が考えられます。

- ページング機能を実装し、一度に表示するデータ量を制限する
- 画像キャッシュを適切に管理する
- ステートレス Widgetを使用する、もしくはステートフル Widgetの使用範囲を限定する
- 不要なデータやウィジェットを適切に破棄する

大量のデータを扱う場合は、パフォーマンスとメモリ使用量に注意を払う必要があります。上記の対策を講じることで、アプリのメモリ使用量を適切に管理できると考えられます。
光岡 高宏光岡 高宏

Gemini

はい、このコードはメモリを大量に使用 する可能性があります。

可能性が高い理由:

大量のデータ:
queryMochmatchDataRecordOnce 関数は、すべてのショップデータを一度に取得します。
取得したデータはメモリに保持されます。
ショップデータが多い場合、メモリ使用量が大幅に増加します。
画像:
ショップデータに画像が含まれている場合、画像はメモリにキャッシュされます。
画像が多い場合、メモリ使用量が大幅に増加します。
複雑な UI:
リストページの UI が複雑な場合、多くのウィジェットがメモリに保持されます。
複雑な UI は、メモリ使用量の増加につながります。
メモリ使用量を抑える方法:

データの取得を最適化する:
必要なデータのみを取得するように queryMochmatchDataRecordOnce 関数を調整します。
データをページングして、一度に取得するデータ量を制限します。
画像のキャッシュを管理する:
画像を必要に応じてのみキャッシュします。
キャッシュされた画像のサイズを小さくします。
UI を簡略化する:
不要なウィジェットを削除します。
効率的なウィジェットを使用します。
メモリ使用量を監視する:

Flutter DevTools を使用して、アプリのメモリ使用量を監視します。
メモリ使用量が許容範囲を超えている場合は、上記の対策を講じます。
その他の注意事項:

アプリのメモリ使用量は、デバイスによって異なります。
低メモリデバイスでは、メモリ使用量を抑える対策が特に重要になります。
メモリ使用量に関する詳細情報:

Flutter のメモリ使用量: [無効な URL を削除しました]
Flutter DevTools: https://flutter.dev/docs/development/tools/devtools
光岡 高宏光岡 高宏

試しにリストページで画像表示しないようにしたらメモリ全然使わなくなった
(〜 300 MB くらい)

光岡 高宏光岡 高宏

一旦、リストページの画像を非表示にする案を試すのが良さそう

光岡 高宏光岡 高宏

一旦、リストページの画像を非表示にする案を試すのが良さそう

こちらで進めるで着地!

光岡 高宏光岡 高宏

今週は Flutter DevTools とちょっと仲良くなった 1 週間でした
お疲れ様でした!

このスクラップは2024/03/30にクローズされました