Type 'String' is not a subtype of type 'int' of 'index'
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 |
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 '18 at 16:30
add a comment |
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 '18 at 16:26
Sami-LSami-L
2,01493862
2,01493862
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 '18 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 '18 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 '18 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 '18 at 16:30
add a comment |
1 Answer
1
active
oldest
votes
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 '18 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 '18 at 16:48
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
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
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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 '18 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 '18 at 16:48
add a comment |
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 '18 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 '18 at 16:48
add a comment |
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 '18 at 16:31
Mina SamyMina Samy
7,3201276134
7,3201276134
@Sami-L can you post the new error?
– Mina Samy
Nov 21 '18 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 '18 at 16:48
add a comment |
@Sami-L can you post the new error?
– Mina Samy
Nov 21 '18 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 '18 at 16:48
@Sami-L can you post the new error?
– Mina Samy
Nov 21 '18 at 16:44
@Sami-L can you post the new error?
– Mina Samy
Nov 21 '18 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 '18 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 '18 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.
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 '18 at 16:30