Questions tagged [non-nullable]
232 questions
0
votes
1 answer
Flutter: Bluetoothdevice
I'm working on a flutter project that receives data from a ble device, when I created the project It worked but now I copied the program to another project and there's an error that I don't know how to solve.
the error is in this…
0
votes
1 answer
Flutter-Non-nullable instance field ‘{0}’ must be initialized error
I have created a seperate class "DirectionDetails" which is;
class DirectionDetails{
int distanceValue;
int durationValue;
String distanceText;
String durationText;
String encodedPoints;
DirectionDetails(this.distanceValue,…

Manodhya Opallage
- 301
- 2
- 9
0
votes
3 answers
Error: Null safety features are disabled for this library in Flutter
I added non-nullabe in pubspec as well. I don't want to change my SDK version, cuz I have already been using it for other dependencies and it will cause errors if I change the version. Please let me know how can I remove this error. Please let me…

Nabia Salman
- 552
- 1
- 8
- 29
0
votes
1 answer
C# non-nullable compiler warning when property was checked in a validation method
I have a class that has a property declared as string? Email { get; set; } and a method that will return false if the email is empty or null for validation. There are other more complex checks in this method, so I am excluding them below for…

Scott Collins
- 75
- 6
0
votes
4 answers
R: count distinct IDs where selected column is non-null
I have the following dataframe:
user_id <- c(97, 97, 97, 97, 96, 95, 95, 94, 94)
event_id <- c(42, 15, 43, 12, 44, 32, 38, 10, 11)
plan_id <- c(NA, 38, NA, NA, 30, NA, NA, 30, 25)
treatment_id <- c(NA, 20, NA, NA, NA, 28, 41, 17, 32)
system <- c(1,…

Austin Gilbert
- 43
- 4
0
votes
1 answer
How to run Dart tests after enabling the NNBD experiment
I have just updated to latest dart-beta version (2.11.0-213.5.beta) and upgraded my dependencies to use the null safety versions:
dev_dependencies:
pedantic: ^1.10.0-nullsafety
test: ^1.16.0-nullsafety
I can successfully run dart analyze .…

Renato
- 12,940
- 3
- 54
- 85
0
votes
3 answers
Representing search failure with a non-nullable type
I have a method that searches a list of objects based on some of the fields of the object. If a matching object is found, I return it, but I want to be able to represent a no-match situation. Normally I'd return null but I'm working with a…

Hui
- 13,887
- 8
- 25
- 20
0
votes
2 answers
How can I override Kotlin's null safety to create a bad request for testing?
I have a service written in Kotlin, which doesn't let you assign a non-nullable parameter to null. Unfortunately, my client code is in a different language which doesn't care whatsoever for Kotlin's rules, so the service gets calls pretty frequently…

StolenKitten
- 337
- 1
- 10
0
votes
2 answers
Why checking a Non-nullable type against null actually compiles in C#8
I am trying to use Nullable Reference Types in C# 8.0. I have set up a sample code to test it, but something has confused me.
As I understand it, when you do not add the ? symbol to a type, it is treated as a non-nullable reference type. However, in…

Vahid
- 5,144
- 13
- 70
- 146
0
votes
0 answers
How to deal with Unsafe null type conversion
I have a part of a code where "Currencies" is Enum and "Currency" is Entity:
public final Map currencies = new EnumMap<>(Currencies.class);
But Eclipse generates a warning:
Unsafe null type conversion (type annotations):
The…

horvoje
- 643
- 6
- 21
0
votes
1 answer
Covnerting null literal to non-null C# 8
With C#8 and null reference turn on, I now get this warning, item is highlighted with Converting null literal or possible null value to non nullable type. The Class rtGirdProp has no non nullable items. How do I fix this?
enter code here
…

Jason
- 81
- 6
0
votes
3 answers
Are there plans to add type-checked nullable types to Java?
One of my favorite things about Kotlin, relative to Java, is that you can use the compiler to guarantee that certain values are never null. (Swift also has this feature.)
var foo: Thing
var bar: Thing?
Is that example, foo can never be null. I…

Rob N
- 15,024
- 17
- 92
- 165
0
votes
2 answers
Kotlin: Even if the class has a nullable generic parameter type E, assignement fails
I'm struggling with nullable and non-nullable types. There are two errors.
I defined a class which implements the "Queue" concept, as follows, trying to make its Generic Parametric Type nullable and here there's the first error:
class…

Marco Ottina
- 399
- 5
- 12
0
votes
0 answers
Type Arguments Constraining NonNullable
Is there a way to use the conditional type NonNullable, inside the declaration block of T, getting the same result as de function bellow. Or a simpler way to get the same result?
function logObj<
T extends string | boolean | string | object |…

Cássio
- 149
- 2
- 10
0
votes
1 answer
java.lang.IllegalArgumentException: Parameter specified as non-null is null error in Java code
I am using this Kfilter library for adding filters in my code written in JAVA.
I am getting this error java.lang.IllegalArgumentException: Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkParameterIsNotNull while…

raghhav
- 167
- 2
- 13