1
votes

flutter_google_places: erreur de plugin ^ 0.2.1 dans le fichier pubspec.yaml

Obtenir une erreur dans le fichier pubspec.yaml avec flutter_google_places: ^ 0.2.1 plugin comme ci-dessous: Comment puis-je me débarrasser de ce type de problèmes de flutter.

Remarque: il n'y a pas d'indentation pour le package

Erreur à la ligne 18, colonne 3 de pubspec.yaml: un package ne peut pas s'afficher comme une dépendance. flutter_google_places: ^ 0.2.1
^^^^^^^^^^^^^^^^^^^^^^

Fichier pubspec.yaml:

name: flutter_google_places
description: A new Flutter application.

# 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.
# Read more about versioning at semver.org.
version: 1.0.0+1

environment:
  sdk: ">=2.0.0-dev.68.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  flutter_google_places: ^0.2.1
  # 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://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


0 commentaires

3 Réponses :


4
votes

Vous ne pouvez pas avoir une dépendance qui porte le même nom que votre projet

name: flutter_google_places

Vous devez changer le name: ...


0 commentaires

1
votes

il doit y avoir un problème avec le nom de votre projet. Le nom du projet ne peut pas être identique à un nom de package.


0 commentaires

0
votes

Le nom du projet et le titre de la dépendance doivent être différents.

Nom:

name: sqflite          //project_name
description: A new Flutter application.
publish_to: 'none'
version: 1.0.0+1
environment:
  sdk: ">=2.7.0 <3.0.0"
dependencies:
  flutter:
    sdk: flutter
sqflite: ^1.3.1+1       //dependency_name

et

dependencies:
  flutter:
    sdk: flutter
  flutter_google_places: ^0.2.1

Ne pas utiliser project_name et DEPENDENCY_NAME même chaîne
Exemple: - fichier pubspec.yaml

 name: flutter_google_places<br>


0 commentaires