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

Generated code not support null safety #147

Closed
Abdktefane opened this issue Oct 23, 2020 · 7 comments
Closed

Generated code not support null safety #147

Abdktefane opened this issue Oct 23, 2020 · 7 comments

Comments

@Abdktefane
Copy link

final getIt = GetIt.I;

@InjectableInit(
  initializerName: r'$initGetIt', // default
  preferRelativeImports: true, // default
  asExtension: false, // default
)
Future<GetIt> initAppDependencies({String? environment}) async =>
    await $initGetIt(getIt);

the generated code

Future<GetIt> $initGetIt(
  GetIt get, {
  String environment, // should be String? environment
  EnvironmentFilter environmentFilter, // EnvironmentFilter? environmentFilter
}) async {
.........
}
@Overman775
Copy link

Overman775 commented Dec 7, 2020

@Milad-Akarie Please add null safety prerelease version like in other packages 😃

@daniel-forsdike
Copy link

Any movement here?

@heman4t
Copy link

heman4t commented Feb 14, 2021

My current project is using null safety. Although not a big deal in just adding 2 "?" everytime I run build runner. i.e.

Future<GetIt> $initGetIt(
  GetIt get, {
  String? environment, // should be String? environment
  EnvironmentFilter? environmentFilter, // EnvironmentFilter? environmentFilter
}) async {
...

and everything runs smoothly.

@Milad-Akarie can't we just add these 2 "?" in nullsafety version?. Because I have tested it on both android and web. And everything runs smoothly.

@Milad-Akarie
Copy link
Owner

@heman4t I've already started refactoring the code to support null safety, this might take some time though.

@kansson
Copy link

kansson commented Feb 19, 2021

@Milad-Akarie is there an eta on when this will be done?

@Milad-Akarie
Copy link
Owner

@heman4t @essarn the generated code can now include null safety suffixes in version 1.1.0,

@InjectableInit(
  usesNullSafety: true,
)

this will only add (?) suffix to (environment & environmentFilter)
the official null-sefety version will properly be uploaded sometime tomorrow.
(please confirm)
Thanks for your patience

@heman4t
Copy link

heman4t commented Feb 21, 2021

@heman4t @essarn the generated code can now include null safety suffixes in version 1.1.0,

@InjectableInit(
  usesNullSafety: true,
)

this will only add (?) suffix to (environment & environmentFilter)
the official null-sefety version will properly be uploaded sometime tomorrow.
(please confirm)
Thanks for your patience

That's cool. Working perfectly.

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

6 participants