Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8909721
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T03:30:15+00:00 2026-06-15T03:30:15+00:00

I am trying to learn client-side Dart, coming from a server-side Java EE world,

  • 0

I am trying to learn client-side Dart, coming from a server-side Java EE world, and I am having trouble converting an array from an existing JavaScript library into a Dart List.

I am trying to learn by building on the Javascript Interop example that uses Google Maps. In Google’s Maps API’s documentation, the DirectionsLeg object’s step property returns.

array of DirectionsSteps, each of which contains information about the individual steps in this leg

How can I convert this var into a Dart List? I have tried the following:

final List<maps.DirectionsStep> steps = List.from(directionsLeg.steps);

But Dart Editor tells me cannot resolve method 'from' in class 'List'. My imports are:

import 'dart:html';
import 'dart:core';
import 'package:js/js.dart' as js;

What am I doing wrong? Is it even possible or must I just accept using a var?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T03:30:16+00:00Added an answer on June 15, 2026 at 3:30 am

    There’s no built-in way in js-interop for now to use Dart List when a js Array is returned.

    directionsLeg.steps returns a js.Proxy which handles like js Array. You can iterate on it like this :

    final steps = directionsLeg.steps;
    for (var i = 0; i < steps.length ; i++) {
      final step = steps[i];
      // do the job with step
    }
    

    If you really want to use a Dart List you can convert the js.Proxy of js Array to a Dart List with something like :

    List<js.Proxy> convertToList(js.Proxy arrayProxy){
      final result = new List<js.Proxy>();
      for (var i = 0; i < arrayProxy.length ; i++) {
        result.add(arrayProxy[i]);
      }
      return result;
    }
    

    About your code :

    • You can’t define List<maps.DirectionsStep> : maps.DirectionsStep is not a type, it’s a js.Proxy on js google.maps.DirectionsStep (moreover it don’t really exist – only a container js object {}).
    • List.from(...) : here, you try to call a static method named from on Dart List object. That why you get your error. List.from is actually a factory named constructor and has to be used with the new keyword ( new List.from(otherIterable) ).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay so I'm trying to learn Java client/server stuff, and am going through the
I am trying to learn WCF. I have a simple client and server application
I´m trying to learn C#, coming from a Python/PHP background, and I´m trying to
I'm trying to learn to call SharePoint Web Services from an external C# client.
Hi I am having trouble I am trying to learn restful services.I created a
I'm trying to learn how to do some very simple client-server application programming. Basically,
I'm trying to create a client-server application in Java. This application will be transferring
I am trying to learn WCF with this example http://www.codeproject.com/Articles/39143/C-WCF-Client-Server-without-HTTP-with-Callbacks-Ma Also trying to extend
I'm trying to learn / understand client-side validation with jquery.validate. Currently, I have a
I've been having some trouble lately while trying to learn how to do an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.