Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internation­alizing issue #43

Closed
alefcarlos opened this issue Aug 20, 2019 · 8 comments
Closed

Internation­alizing issue #43

alefcarlos opened this issue Aug 20, 2019 · 8 comments

Comments

@alefcarlos
Copy link

Hi !

After I added Localizations into my app(following this tutorial ) I got this issue when I interact with the Picker:

[VERBOSE-2:ui_dart_state.cc(148)] Unhandled Exception: NoSuchMethodError: The method 'call' was called on null.
Receiver: null
Tried calling: call()
#0      _rootRun  (dart:async/zone.dart:1120:38)
#1      _CustomZone.run  (dart:async/zone.dart:1021:19)
#2      _FutureListener.handleWhenComplete  (dart:async/future_impl.dart:150:18)
#3      Future._propagateToListeners.handleWhenCompleteCallback  (dart:async/future_impl.dart:609:39)
#4      Future._propagateToListeners  (dart:async/future_impl.dart:665:37)
#5      Future._completeWithValue  (dart:async/future_impl.dart:483:5)
#6      Future._asyncComplete.<anonymous closure>  (dart:async/future_impl.dart:513:7)
#7      _rootRun  (dart:async/zone.dart:1124:13)
#8      _CustomZone.run  (dart:async/zone.dart:1021:19)

Do I need to implement something else ?

My app supported languages:

MaterialApp(
          localizationsDelegates: [
            AppLocalizationsDelegate(),
            GlobalMaterialLocalizations.delegate,
            GlobalWidgetsLocalizations.delegate,
            GlobalCupertinoLocalizations.delegate,
          ],
          supportedLocales: [
            const Locale('pt', 'BR'),
            const Locale('en', 'US'),
          ],

My AppLocalization`s load method:

  static Future<AppLocalizations> load(Locale locale) async {
    final String name =
        (locale.countryCode != null && locale.countryCode.isEmpty)
            ? locale.languageCode
            : locale.toString();
    final String localeName = Intl.canonicalizedLocale(name);
    await initializeMessages(localeName);

    Intl.defaultLocale = localeName;
    return AppLocalizations();
  }

flutter doctor:

[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.6 18G87, locale pt-BR)
    • Flutter version 1.7.8+hotfix.4 at /Users/alefcarlos/development/flutter
    • Framework revision 20e59316b8 (5 weeks ago), 2019-07-18 20:04:33 -0700
    • Engine revision fee001c93f
    • Dart version 2.4.0

 
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
    • Android SDK at /Users/alefcarlos/Library/Android/sdk
    • Android NDK location not configured (optional; useful for native profiling support)
    • Platform android-28, build-tools 28.0.3
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.3, Build version 10G8
    • CocoaPods version 1.7.5

[✓] iOS tools - develop for iOS devices
    • ios-deploy 1.9.4

[✓] Android Studio (version 3.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 33.4.1
    • Dart plugin version 182.5215
    • Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)

[✓] VS Code (version 1.37.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.3.0

[✓] Connected device (1 available)
    • iPhone Xʀ • 5023658E-C713-4EC6-9792-56D738EBB720 • ios • com.apple.CoreSimulator.SimRuntime.iOS-12-4 (simulator)

• No issues found!

Thank you for this amazing plugin !

@alefcarlos alefcarlos changed the title Localization issue Internation­alizing issue Aug 20, 2019
@alefcarlos
Copy link
Author

this is related to #40

@alefcarlos
Copy link
Author

alefcarlos commented Aug 20, 2019

The problem is in this line

My onClose property is null, but it is a required parameter for whenComplete method.

void _showDatePicker({
    @required BuildContext context,
    @required DateTime maxDate,
    @required DateTime initDate,
    @required Function(DateTime, List<int>) onConfirm,
    DateTime minDate,
  }) {
    DatePicker.showDatePicker(context,
        minDateTime: minDate ?? null,
        maxDateTime: maxDate,
        dateFormat: 'dd-MMMM-yyyy',
        initialDateTime: initDate,
        locale: DateTimePickerLocale.pt_br,
        onConfirm: onConfirm);
  }

Should I make a PR to solve this ?

@dwikresno
Copy link

i got same issue, can you fix it soon please, because I used this for production already, thanks

@dwikresno
Copy link

dwikresno commented Aug 20, 2019

sorry, it's #solved, just give onClose(){}

@alefcarlos
Copy link
Author

@dwikresno: But don't you agree that must be explicitly? I thing this parameter must be annoted with @required. I'm gonna make a PR with this fix.

dylanwuzh added a commit that referenced this issue Aug 23, 2019
@dylanwuzh
Copy link
Owner

dylanwuzh commented Aug 23, 2019

Please upgrade to version: v1.0.12, the onClose is not required.

@dwikresno
Copy link

okay, thanks

@yehongxia
Copy link

加载 flutter_cupertino_date_picker并运行flutter run 时报Error: The superclass, 'Diagnosticable', has no unnamed constructor that takes no arguments. 这个与什么有关

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants