LoginSignup
0
0

More than 3 years have passed since last update.

[Flutter]assetsから画像を取る方法

Posted at

まずimagesファイルを作る

プロジェクトに画像を入れるための新規ディレクトリを作る
ここではimagesファイルに、ruby.pngという画像を入れたと仮定する。

pubspec.yamlのassets:に記載する

flutter:
    assets:
      - images/ruby.png

という感じで記載する。

呼び出す

example.dart
body: Center(
  child: Image(
    image: AssetImage("images/diamond.png"),
  ),
),

これでおk

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0