リスト 4.14


//flutter
import 'package:flutter/material.dart';

void main() {
  return runApp(TestPage());
}

//リスト4.14
class TestPage extends StatelessWidget{
  final _path =
    'https://flutter.github.io/assets-for-api-docs/assets/widgets/owl.jpg';

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'イメージ',
      home: Scaffold(
        appBar: AppBar(title: Text('イメージ')),
        body: Center(
          child: Image.network(_path, scale: 2, errorBuilder:
            (BuildContext context, Object exception, StackTrace? stackTrace) {
              return Icon(Icons.image_not_supported_outlined);
            })),
      ));
  }
}