locale_observer 1.0.0+2

Flutter Android iOS

Utility for detecting when the system tells the app that the user's locale has changed.

example/lib/main.dart

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

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return LocaleObserver(
      didChangeLocales: (BuildContext context, List<Locale> locales) {
        print("locales = $locales");
      },
      child: MaterialApp(
        home: HomePage(),
      ),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  HomePageState createState() => HomePageState();
}

class HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Plugin example app'),
      ),
      body: Center(
        child: Text(''),
      ),
    );
  }
}
0
likes
90
pub points
48%
popularity

Utility for detecting when the system tells the app that the user's locale has changed.

Repository (GitHub)
View/report issues

Documentation

API reference

Uploader

humazed@gmail.com

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on locale_observer