locale_observer 1.0.0+2 copy "locale_observer: ^1.0.0+2" to clipboard
locale_observer: ^1.0.0+2 copied to clipboard

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
30
pub points
24%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on locale_observer