MissingPluginException in flutter - android

I am trying to use image picker but I am unable too fetch.
Whenever I called Imagepicker, it is showing error as No implementation found for method pickImage on channel plugins.flutter.io/image_picker.
Please let me know of this issue.
I updated my question and added pubspec.yaml
name: demo_flutter
description: A new Flutter application.
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
video_player: ^0.5.2
image_picker: ^0.5.0+1
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
assets:
- images/onnet.png
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.io/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.io/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.io/custom-fonts/#from-packages

use command on terminal (cmd)
flutter clean
then rebuild your app
its work for me.

Related

in TabController in vcync:"property" problem ? and in pubspec file can not get font and images?

i got this type of error error image
and in pubspec file only one file get error that can not get any image and font family form pubpce
and The error "can not allow in vsync property" in Flutter might indicate that there is an issue with the vsync property you are trying to set.
in TabController.
and in pubspec file dont show any error regarding image and font.
and yes before using images and font working properly or i am applying any off file new image or font can not get on display
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number is used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.0.0+1
environment:
sdk: '>=2.18.6 <3.0.0'
# Dependencies specify other packages that your package needs in order to work.
# To automatically upgrade your package dependencies to the latest versions
# consider running `flutter pub upgrade --major-versions`. Alternatively,
# dependencies can be manually updated by changing the version numbers below to
# the latest version available on pub.dev. To see which dependencies have newer
# versions available, run `flutter pub outdated`.
dependencies:
flutter:
sdk: flutter
hovering: ^1.0.4
hover_effect: ^0.6.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
google_fonts: ^4.0.3
video_player: ^2.5.1
slider_button: ^2.0.0
animations: ^2.0.7
dev_dependencies:
flutter_test:
sdk: flutter
# The "flutter_lints" package below contains a set of recommended lints to
# encourage good coding practices. The lint set provided by the package is
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^2.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter packages.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:\
assets:
- assets/images/
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
fonts:
- family: GallientRegular
fonts:
- asset: assets/fonts/GallientRegular-eZoMp.ttf
- family: Playfair_Display
fonts:
- asset: assets/fonts/PlayfairDisplay-VariableFont_wght.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
You need to use TickerProviderStateMixin/SingleTickerProviderStateMixin to get vertical-sync
like
class _FAState extends State<FA> with SingleTickerProviderStateMixin {
late final controller = TabController(length: 3, vsync: this);
Also you can use initSate instead of late.

"Unable to load asset: null" in my flutter app

When my app loads, no image loads at all, and t just crashes and i keep getting this error in my flutter app but I can't seem to find the problem, usually, when it can't find load an asset it tells me which asset, but this time it just says unable to load asset null, I don't know how to find the problem
it shows a breakpoint at this point
/// An [AssetBundle] that loads resources using platform messages.
class PlatformAssetBundle extends CachingAssetBundle {
#override
Future<ByteData> load(String key) async {
final Uint8List encoded = utf8.encoder.convert(Uri(path: Uri.encodeFull(key)).path);
final ByteData? asset =
await defaultBinaryMessenger.send('flutter/assets', encoded.buffer.asByteData());
if (asset == null)
throw FlutterError('Unable to load asset: $key'); ******RIGHT HERE IS THE BREAKPOINT
return asset;
}
}
this is pub yaml file
name: wepay
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: "^0.8.0"
page_indicator: ^0.3.0
twitter_qr_scanner: any
audioplayers: ^0.16.2
modal_bottom_sheet: 0.2.2
overlay_screen: ^1.2.0+1
show_up_animation: ^1.0.4
flutter_spinkit: "^4.1.2"
auto_size_text: ^2.1.0
cloud_firestore: ^0.14.0
firebase_core : ^0.5.0
qr_flutter: ^3.2.0
intl: ^0.16.1
secure_random: ^1.0.0
fluttertoast: ^7.0.1
clipboard: ^0.1.2+8
social_share: ^2.0.5
flutter_icons:
android: "icon"
ios: true
image_path: "assets/images/icon.png"
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
assets:
- assets/images/
- assets/sounds/scan.mp3
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
fonts:
- family: Montserrat
fonts:
- asset: assets/fonts/Montserrat-Black.ttf
weight: 900
- asset: assets/fonts/Montserrat-Bold.ttf
weight: 700
- asset: assets/fonts/Montserrat-ExtraBold.ttf
weight: 800
- asset: assets/fonts/Montserrat-Medium.ttf
weight: 500
- asset: assets/fonts/Montserrat-Regular.ttf
weight: 400
- asset: assets/fonts/Montserrat-SemiBold.ttf
weight: 600
- family: Roboto
fonts:
- asset: assets/fonts/Roboto-Regular.ttf
- asset: assets/fonts/Roboto-Bold.ttf
- asset: assets/fonts/Roboto-Light.ttf
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
This is the most common error.
It's because of spacing mistake you have in "assets:" in the pubspec.yaml
You should change the indentation spacing for assets
flutter:
assets:
- images/apple.png
- images/apple1.png
Maintain this correct spacing:
flutter:
[2 whitespaces or 1 tab]assets:
[3 whitespaces]- images/pizza1.png
[3 whitespaces]- images/pizza0.png
In your pubspec.yaml you need to specify every single folder you want to use. Just the folder name is enough if you want to include all the files inside. Like this:
flutter:
uses-material-design: true
assets:
- assets/
- assets/images/
- assets/sounds/
Make sure the two spaces indentation in YAML files.
And try to replace
await defaultBinaryMessenger.send('flutter/assets', encoded.buffer.asByteData());
with
await ServicesBinding.instance.defaultBinaryMessenger.send('flutter/assets', encoded.buffer.asByteData());
Don't forget to add:
import 'binding.dart';
Try if this works for you.

Execution failed for task ':google_sign_in:verifyReleaseResources'. Flutter google sign in

I have created an app with flutter and firebase and i am trying to create the build apk. but i get error when running flutter build apk. i think it is because my google sign in is not setup for release.
Execution failed for task ':google_sign_in:verifyReleaseResources'.
> 1 exception was raised by workers:
com.android.builder.internal.aapt.v2.Aapt2Exception: Android resource linking failed
E:\Mobile App evelopment\
Fiverr\pet_walker\build\google_sign_in\intermediates\res\merged\
release\values\values.xml:314: error: resource android:attr/fontVariationSettings not found.
I have signed android apk but i have not got sha-1 production certificate for flutter. someone please guide me how to setup google sign in for production
here is the pubspec.yaml file
name: pet_walker
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: "none" # Remove this line if you wish to publish to pub.dev
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3
firebase_auth: ^0.15.0+1
cloud_firestore: ^0.13.7
provider: ^4.3.1
flutter_spinkit: "^4.1.2"
flutter_facebook_login: ^3.0.0
google_sign_in: ^3.2.4
after_layout: ^1.0.7+2
firebase_storage: ^3.1.6
image_picker: ^0.6.7+4
uuid: 2.2.0
cached_network_image: ^2.2.0+1
popup_menu: ^1.0.5
google_maps_flutter: ^0.5.28+1
geolocator: ^5.3.2+2
latlong: ^0.6.1
carousel_slider: ^2.2.1
geocoder: ^0.2.1
geoflutterfire: ^2.1.0
firebase_core: ^0.4.2
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
assets:
- assets/
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages

Flutter import 'package:flutter_svg/flutter_svg.dart'; not working on the VS code and Android studio

I created a Flutter project, and I have an error on the line:
import package:flutter_svg/flutter_svg.dart
I already followed this structure from flutter_svg documentation.
It does not get identified on VS Code and Android Studio.
Any solution for this?
This is my pubspec.yaml
name: first_project
description: A new Flutter project.
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_svg: ^0.18.0
google_fonts: ^1.0.0
flutter_swiper: ^1.1.6
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
assets:
- assets/icons/
- assets/images/
- assets/svg/
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/custom-fonts/#from-packages
Always remember, indentation plays a huge deal in pubspec.yaml files. Anyway, your dependencies in pubspec.yaml should look something like this:
dependencies:
flutter:
sdk: flutter
flutter_svg: ^0.18.0
google_fonts: ^1.0.0
flutter_swiper: ^1.1.6
Run this package on the terminal
flutter pub add flutter_svg

How to give share option through flutter application

I am new to flutter I have gone through the below link to implement share option through my application but that package is not working my flutter version is 0.5.1 and if I add that package in pubspec.yaml I'm getting this error please help me out
name: share
description: A new Flutter project.
dependencies:
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
share: ^0.5.3
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add assets to your application, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.io/assets-and-images/#resolution-aware.
# For details regarding adding assets from package dependencies, see
# https://flutter.io/assets-and-images/#from-packages
# To add custom fonts to your application, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.io/custom-fonts/#from-packages
Result::
[share] flutter packages get
Running "flutter packages get" in share...
Error on line 11, column 3 of pubspec.yaml: A package may not list itself as a dependency.
share: ^0.5.3
^^^^^
pub get failed (65)
exit code 65
Here is the link what I refered:
https://pub.dartlang.org/packages/share
PS: Let me know if there is any other way to achieve that.
Add Package in pubspec.yaml
share: ^0.5.3
import 'package:share/share.dart';
void _onShareTap() {
final RenderBox box = context.findRenderObject();
Share.share(share,
sharePositionOrigin: box.localToGlobal(Offset.zero) & box.size);
}
pubspec.yaml
dependencies:
share: ^0.5.3
Dart file:
import 'package:share/share.dart';
final RenderBox box = context.findRenderObject();
Share.share(BASE64_IMAGE,sharePositionOrigin: box.localToGlobal(Offset.zero) & box.size);
The problem is your package name(first line in pubspec.yaml). It's the same as one of the dependency name: share. Please rename it to something else and try again.

Categories

Resources