flutterdartlocalization

How is `flutter_localizations` imported into Flutter project when it's not available on pub.dev?


I am wondering how this is possible. The flutter_localizations package is not on pub.dev which makes me think that it's part of flutter package? But if so, how come I have to import it like package:flutter_localizatoins/flutter_localizations.dart into a project?


Solution

  • Check out the official docs

    TLDR: In your pubspec.yaml, is not added like a regular dependency

    dependencies:
      flutter:
        sdk: flutter
      flutter_localizations:
        sdk: flutter
    

    It works the same way as flutter(it comes bundled with the sdk itself) which you also import its packages like: import 'package:flutter/material.dart'