Type 'String' is not a subtype of type 'int' of 'index'
up vote
0
down vote
favorite
My App can authenticate successfully when debugging against the Android emulator, but if I try to authenticate using debugging against the physical device (with same OS version), an error message appears after more than one minute waiting:
Exception has occurred.
_TypeError (type 'String' is not a subtype of type 'int' of 'index')
The error message points to the following code:
if (responseJson[AuthUtils.authTokenKey] != null) {
AuthUtils.insertDetails(
userNameController.text, passwordController.text, responseJson);
...
} else {
...
};
And in the DEBUG CONSOLE I get the following:
I/flutter ( 9531): Auth: SocketException: OS Error: Connection timed
out, errno = 110, address = example.com, port = 38975
V/InputMethodManager( 9531): Starting input:
tba=android.view.inputmethod.EditorInfo@4aece4e nm :
example.com.todoapp ic=null
Here is the screenshot:
What am I doing wrong here ?
android dart flutter
add a comment |
up vote
0
down vote
favorite
My App can authenticate successfully when debugging against the Android emulator, but if I try to authenticate using debugging against the physical device (with same OS version), an error message appears after more than one minute waiting:
Exception has occurred.
_TypeError (type 'String' is not a subtype of type 'int' of 'index')
The error message points to the following code:
if (responseJson[AuthUtils.authTokenKey] != null) {
AuthUtils.insertDetails(
userNameController.text, passwordController.text, responseJson);
...
} else {
...
};
And in the DEBUG CONSOLE I get the following:
I/flutter ( 9531): Auth: SocketException: OS Error: Connection timed
out, errno = 110, address = example.com, port = 38975
V/InputMethodManager( 9531): Starting input:
tba=android.view.inputmethod.EditorInfo@4aece4e nm :
example.com.todoapp ic=null
Here is the screenshot:
What am I doing wrong here ?
android dart flutter
responseJson
seems to be inferred as typeList
and expects an integer in the index accessorresponseJson[intIndexhere]
, butAuthUtils.authTokenKey
is aString
which is not supported here. That would only be supported ifresponseJson
would be aMap
– Günter Zöchbauer
Nov 21 at 16:30
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
My App can authenticate successfully when debugging against the Android emulator, but if I try to authenticate using debugging against the physical device (with same OS version), an error message appears after more than one minute waiting:
Exception has occurred.
_TypeError (type 'String' is not a subtype of type 'int' of 'index')
The error message points to the following code:
if (responseJson[AuthUtils.authTokenKey] != null) {
AuthUtils.insertDetails(
userNameController.text, passwordController.text, responseJson);
...
} else {
...
};
And in the DEBUG CONSOLE I get the following:
I/flutter ( 9531): Auth: SocketException: OS Error: Connection timed
out, errno = 110, address = example.com, port = 38975
V/InputMethodManager( 9531): Starting input:
tba=android.view.inputmethod.EditorInfo@4aece4e nm :
example.com.todoapp ic=null
Here is the screenshot:
What am I doing wrong here ?
android dart flutter
My App can authenticate successfully when debugging against the Android emulator, but if I try to authenticate using debugging against the physical device (with same OS version), an error message appears after more than one minute waiting:
Exception has occurred.
_TypeError (type 'String' is not a subtype of type 'int' of 'index')
The error message points to the following code:
if (responseJson[AuthUtils.authTokenKey] != null) {
AuthUtils.insertDetails(
userNameController.text, passwordController.text, responseJson);
...
} else {
...
};
And in the DEBUG CONSOLE I get the following:
I/flutter ( 9531): Auth: SocketException: OS Error: Connection timed
out, errno = 110, address = example.com, port = 38975
V/InputMethodManager( 9531): Starting input:
tba=android.view.inputmethod.EditorInfo@4aece4e nm :
example.com.todoapp ic=null
Here is the screenshot:
What am I doing wrong here ?
android dart flutter
android dart flutter
asked Nov 21 at 16:26
Sami-L
1,88083659
1,88083659
responseJson
seems to be inferred as typeList
and expects an integer in the index accessorresponseJson[intIndexhere]
, butAuthUtils.authTokenKey
is aString
which is not supported here. That would only be supported ifresponseJson
would be aMap
– Günter Zöchbauer
Nov 21 at 16:30
add a comment |
responseJson
seems to be inferred as typeList
and expects an integer in the index accessorresponseJson[intIndexhere]
, butAuthUtils.authTokenKey
is aString
which is not supported here. That would only be supported ifresponseJson
would be aMap
– Günter Zöchbauer
Nov 21 at 16:30
responseJson
seems to be inferred as type List
and expects an integer in the index accessor responseJson[intIndexhere]
, but AuthUtils.authTokenKey
is a String
which is not supported here. That would only be supported if responseJson
would be a Map
– Günter Zöchbauer
Nov 21 at 16:30
responseJson
seems to be inferred as type List
and expects an integer in the index accessor responseJson[intIndexhere]
, but AuthUtils.authTokenKey
is a String
which is not supported here. That would only be supported if responseJson
would be a Map
– Günter Zöchbauer
Nov 21 at 16:30
add a comment |
1 Answer
1
active
oldest
votes
up vote
1
down vote
I believe that in the line:
responseJson[AuthUtils.authTokenKey]
You're referencing an item in the list responseJson by the index AuthUtils.authTokenKey
And since AuthUtils.authTokenKey is a String, you cannot use it as in index of an array.
So you need first to get the index of AuthUtils.authTokenKey then use it to reference the item:
responseJson[responseJson.indexOf(AuthUtils.authTokenKey)]
@Sami-L can you post the new error?
– Mina Samy
Nov 21 at 16:44
Tried your solution, but instead getting the error message in the screenshot, I got the following: Could not load source 'dart:core/runtime/libstring_patch.dart': <source not available>.
– Sami-L
Nov 21 at 16:48
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
I believe that in the line:
responseJson[AuthUtils.authTokenKey]
You're referencing an item in the list responseJson by the index AuthUtils.authTokenKey
And since AuthUtils.authTokenKey is a String, you cannot use it as in index of an array.
So you need first to get the index of AuthUtils.authTokenKey then use it to reference the item:
responseJson[responseJson.indexOf(AuthUtils.authTokenKey)]
@Sami-L can you post the new error?
– Mina Samy
Nov 21 at 16:44
Tried your solution, but instead getting the error message in the screenshot, I got the following: Could not load source 'dart:core/runtime/libstring_patch.dart': <source not available>.
– Sami-L
Nov 21 at 16:48
add a comment |
up vote
1
down vote
I believe that in the line:
responseJson[AuthUtils.authTokenKey]
You're referencing an item in the list responseJson by the index AuthUtils.authTokenKey
And since AuthUtils.authTokenKey is a String, you cannot use it as in index of an array.
So you need first to get the index of AuthUtils.authTokenKey then use it to reference the item:
responseJson[responseJson.indexOf(AuthUtils.authTokenKey)]
@Sami-L can you post the new error?
– Mina Samy
Nov 21 at 16:44
Tried your solution, but instead getting the error message in the screenshot, I got the following: Could not load source 'dart:core/runtime/libstring_patch.dart': <source not available>.
– Sami-L
Nov 21 at 16:48
add a comment |
up vote
1
down vote
up vote
1
down vote
I believe that in the line:
responseJson[AuthUtils.authTokenKey]
You're referencing an item in the list responseJson by the index AuthUtils.authTokenKey
And since AuthUtils.authTokenKey is a String, you cannot use it as in index of an array.
So you need first to get the index of AuthUtils.authTokenKey then use it to reference the item:
responseJson[responseJson.indexOf(AuthUtils.authTokenKey)]
I believe that in the line:
responseJson[AuthUtils.authTokenKey]
You're referencing an item in the list responseJson by the index AuthUtils.authTokenKey
And since AuthUtils.authTokenKey is a String, you cannot use it as in index of an array.
So you need first to get the index of AuthUtils.authTokenKey then use it to reference the item:
responseJson[responseJson.indexOf(AuthUtils.authTokenKey)]
answered Nov 21 at 16:31
Mina Samy
7,2001275134
7,2001275134
@Sami-L can you post the new error?
– Mina Samy
Nov 21 at 16:44
Tried your solution, but instead getting the error message in the screenshot, I got the following: Could not load source 'dart:core/runtime/libstring_patch.dart': <source not available>.
– Sami-L
Nov 21 at 16:48
add a comment |
@Sami-L can you post the new error?
– Mina Samy
Nov 21 at 16:44
Tried your solution, but instead getting the error message in the screenshot, I got the following: Could not load source 'dart:core/runtime/libstring_patch.dart': <source not available>.
– Sami-L
Nov 21 at 16:48
@Sami-L can you post the new error?
– Mina Samy
Nov 21 at 16:44
@Sami-L can you post the new error?
– Mina Samy
Nov 21 at 16:44
Tried your solution, but instead getting the error message in the screenshot, I got the following: Could not load source 'dart:core/runtime/libstring_patch.dart': <source not available>.
– Sami-L
Nov 21 at 16:48
Tried your solution, but instead getting the error message in the screenshot, I got the following: Could not load source 'dart:core/runtime/libstring_patch.dart': <source not available>.
– Sami-L
Nov 21 at 16:48
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416469%2ftype-string-is-not-a-subtype-of-type-int-of-index%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
responseJson
seems to be inferred as typeList
and expects an integer in the index accessorresponseJson[intIndexhere]
, butAuthUtils.authTokenKey
is aString
which is not supported here. That would only be supported ifresponseJson
would be aMap
– Günter Zöchbauer
Nov 21 at 16:30