Dart: The argument type 'String?' can't be assigned to the parameter type 'String'
You passed a value whose type does not match what the function parameter requires.
The argument type 'String?' can't be assigned to the parameter type 'String'The argument type 'int' can't be assigned to the parameter type 'double'A value of type 'int?' can't be assigned to a variable of type 'int'The argument type 'Future<String>' can't be assigned to the parameter type 'String' Meaning
Most often a nullable value (String?) is passed where a non-nullable type is expected, or int/double/String are mixed. Convert (int.parse, .toString()), handle null (?? ''), or change the parameter type.
Common causes
- Nullable value passed to non-nullable parameter
- int vs double mismatch
- String vs num
- Wrong generic type (List<dynamic> vs List<String>)
- Passing a Future where a value is expected
⚡ Quick fix
- Provide a default:
value ?? '' - Convert the type explicitly
- Fix the function signature to accept the type
Detailed fix by platform
Dart
Text(user.name ?? 'Unknown')forString?values
How to diagnose
- Types — Argument vs parameter?
- Null — Nullable involved?
- Conversion — Needed?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Flutter / Dart
- setState() called after dispose() Flutter: setState() called after dispose(): _MyState#1a2b3 (lifecycle state: defunct, not mounted)
- A RenderFlex overflowed Flutter: A RenderFlex overflowed by x pixels on the right/bottom
- SocketException: Failed host lookup Flutter: Unhandled Exception: SocketException: Failed host lookup: 'api.example.com' (OS Error: No address associated with hostname, errno = 7)
Other ways to find it
Where this error sits
Origin: On your device. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 4 Nov 2026