GlobalMaterialLocalizations.delegate Does not Support Chinese

425 Views Asked by At

It seems GlobalMaterialLocalizations.delegate does not support the zh Locale (Chinese).

Is it really necessary adding GlobalCupertinoLocalizations.delegate before other locales works?

I get this error each time I run the app without adding the GlobalCupertinoLocalizations delegate:

enter image description here

Could this be a bug in Flutter? because according to the official Docs HERE the GlobalMaterialLocalizations.delegate does have support for zh - Chinese

The full source code is available HERE

1

There are 1 best solutions below

0
On

Adding the next delegate solves the problem:

import 'package:flutter/material.dart';

class FallbackLocalizationDelegate extends LocalizationsDelegate<MaterialLocalizations> {
  @override
  bool isSupported(Locale locale) => true;

  @override
  Future<MaterialLocalizations> load(Locale locale) async => const DefaultMaterialLocalizations();

  @override
  bool shouldReload(old) => false;
}

Source: Flutter app crashes building the AppBar with multi language using i18n Jetbrains plugin's boilerplate