How to resolve this Ambiguity error in Dart.
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
import 'package:image/image.dart';
return MaterialApp(
title: 'Camera',
home: Scaffold(
body: new Container(
child: _image == null ? Text('No Image to display') : Image.file(_image),
),
floatingActionButton: new FloatingActionButton(onPressed:() {
picker();
},
tooltip: 'Pick image',
child: new Icon(Icons.camera)),
),
);
ERROR:
The name 'Image' is defined in the libraries 'package:flutter/src/widgets/image.dart' and 'package:image/src/image.dart'. (ambiguous_import at [camera] lib\packs\reg.certificate.dart:45)
Image is defined in the Flutter Widget library, and also in the 'package:image/image.dart'. But I want to refer it from Flutter Widget library how to do this?
Here is the image of package:image/image.dart--> library used for decoding the image.
If you have a file named import such as:
Import ‘package:image/image.dart’ as Image;
Then the class in that package will be Image.image
.
import 'package:image/image.dart' as img;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With