最近在開發(fā)項目的時候使用showCupertinoDialog,遇到報
I/flutter (22641): The getter 'alertDialogLabel' was called on null.
I/flutter (22641): Receiver: null
I/flutter (22641): Tried calling: alertDialogLabel
的錯誤。

遇到這個問題的時候以為是title沒有傳入值,但是真正的問題解決辦法為:
第一步:
在MaterialApp 中加入localizationsDelegates,localizationsDelegates為多語言實現(xiàn)代理集合
localizationsDelegates: [
....
const FallbackCupertinoLocalisationsDelegate(),
],
第二步:
創(chuàng)建一個dart文件,名字取為FallbackCupertinoLocalisationsDelegate
import 'package:flutter/cupertino.dart';
class FallbackCupertinoLocalisationsDelegate
extends LocalizationsDelegate {
const FallbackCupertinoLocalisationsDelegate();
@override
? bool isSupported(Locale locale) =>true;
@override
? Future load(Locale locale) =>
DefaultCupertinoLocalizations.load(locale);
@override
? bool shouldReload(FallbackCupertinoLocalisationsDelegate old) =>false;
}
做完前面兩步就可以解決此問題。