Library and parts of Dart do not have bi-directional permission

I have a library "foo" that consists of the "bar" part and imports the dart: io library. The library and part are declared as follows: "foo.dart":

// in foo.dart library foo; import 'dart:io'; part "bar.dart"; // resolves class Foo { Bar bar = new Bar(); // resolves HttpServer server = new HttpServer(); // resolves } 

'foo.dart' and 'bar.dart' are in the same directory.

'bar.dart' refers to the foo library, for example:

 // in bar.dart part of foo; // does not resolve class Bar { Foo foo = new Foo(); // does not resolve HttpServer server = new HttpServer // does not resolve } 

But in the Dart editor, I see a warning in bar.dart saying "Can't solve foo." Accordingly, any import (such as "dart: io") that I declare in foo.dart is not available to bar.dart and does not apply to my definitions of foo.dart, and since bar.dart is part of foo, it is not allowed to import any additional libraries or declare any additional parts.

I would like to arrange my code in such a way that: * any import that I enter in foo.dart is available for bar.dart (and other parts of the source) * library definitions made in one part of the library source are available for other parts of the source libraries. * (obviously) library definitions made in bar.dart are available for foo.dart (this already works as expected)

Can someone please help me figure out how to do this?

+4
source share
1 answer

I think this is just a mistake in the editor. Have you tried to run your program? It should work.

The editor still periodically delays warnings and closes the file or closes the editor for really stuck ones, as a rule, clears it. I will see if I find an error report so that you can run it or perhaps add a log file if it continues to happen to you.

+4
source

Source: https://habr.com/ru/post/1443999/


All Articles