Coder Social home page Coder Social logo

Comments (5)

esDotDev avatar esDotDev commented on August 16, 2024 4

Ya this is just a warning, it should not impact anything. Still it would be nice if this could be patched soon.

from get_it_mixin.

Ruzo avatar Ruzo commented on August 16, 2024 1

It's just an unnecessary_non_null_assertion warning in mixin_state.dart. I did a pull request for the fix but then saw that there was already an old one. Mine has updated packages and stuff.

I don't think there are too many users of this package. I'm guessing that's the reason why Thomas is not spending too much time on it.

from get_it_mixin.

thommy66 avatar thommy66 commented on August 16, 2024

I did some more research since this is a showstopper for me.

The impact of this warning / error is as follows:
notifyListeners() does somehow not work. I use it in a Scaffold with a BottomNavigationBar. This requires to detect if the selected (tab)item changes. The build method of the widget is not immediately called. Sometimes it does rebuild after one minute or so!! Really strange.

So I have loaded a very old project which I used to learn how to work with get_it_mixin. That is extremely simple and has no other packages than get_it / get_it_mixin. It uses version 1.5.1. There no error is displayed and notifyListeners() works just fine.

Looks like there is a problem with version 3.1.3. I tried to use an older version like 1.5.1 but that does not work because of dependencies. Also Version 2.0.0 seems to be to old. I also tried 3.1.0 but there the same error is shown. To me this looks like a dependency problem of recent version with latest versions of Android Studio and the Flutter SDK.

This is my pubspec.yaml file with the latest version and the error shown above:

dependencies:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  bottom_navy_bar: ^6.0.0
  get_it: ^7.2.0
  get_it_mixin: ^3.1.3
  servicestack: ^2.0.0
  font_awesome_flutter: ^9.1.0
  hive: ^2.0.4
  hive_flutter: ^1.1.0
  path_provider: ^2.0.3
  uuid: ^3.0.4
  equatable: ^2.0.3
  intl: ^0.17.0
  tuple: ^2.0.0
  flutter_layout_grid: ^1.0.3
  device_info_plus: ^3.0.1
  network_info_plus: ^2.0.2
  flutter_slidable: ^1.1.0

dev_dependencies:
  flutter_test:
    sdk: flutter

  # The "flutter_lints" package below contains a set of recommended lints to
  # encourage good coding practices. The lint set provided by the package is
  # activated in the `analysis_options.yaml` file located at the root of your
  # package. See that file for information about deactivating specific lint
  # rules and activating additional ones.
  flutter_lints: ^1.0.0
  build_runner: ^2.1.5

I also cleaned the public cache with flutter pub cache clean and then ran flutter pub get to make sure I do not have corrupted stuff in my .pub-cache folder. However this did not help.

I have no idea what else I could try....

from get_it_mixin.

thommy66 avatar thommy66 commented on August 16, 2024

OK, I solved the problem of the changeNotifiers not being registered.

I used get/getX instead of watchOnly. It looks like the listener is registered in watchOnly and not in get.

    // final selectedTab = get<DashboardManager>().selectedTab;  <======  THIS IS WRONG
    final selectedTab = watchOnly((DashboardManager x) => x.selectedTab); <==== THIS IS CORRECT

However, this warning

../../../../Applications/flutter/.pub-cache/hosted/pub.dartlang.org/get_it_mixin-3.1.3/lib/src/mixin_state.dart:495:7: Warning: Operand of null-aware operation '!' has type 'void Function(BuildContext, AsyncSnapshot<R?>, void Function())' which excludes null.
 - 'BuildContext' is from 'package:flutter/src/widgets/framework.dart' ('../../../../Applications/flutter/packages/flutter/lib/src/widgets/framework.dart').
 - 'AsyncSnapshot' is from 'package:flutter/src/widgets/async.dart' ('../../../../Applications/flutter/packages/flutter/lib/src/widgets/async.dart').
      handler!(_element!, watch.lastValue!, watch.dispose);
      ^

remains with the latest Dart/Flutter versions.

from get_it_mixin.

escamoteur avatar escamoteur commented on August 16, 2024

Guys, really sorry about that I couldn't take care earlier of this.

Indeed @thommy66 get really only gets and does not start to monitor changes.

from get_it_mixin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.