1
votes

I've got a Dart application that consists of both client and server components. There are a couple of source files that are needed by both client and server. I'm trying to find a way to share them effectively without publishing a library to pub.

I've read through these docs but it doesn't say how to share a library if you don't want to publish it to pub. I'd like to do something like:

import 'package:../../Shared/lib/shared.dart';

But that doesn't work ("Target of URI does not exist").

What options do I have here?

1

1 Answers

1
votes

Ah, I figured it out. I have to declare a dependency in my pubspec.yaml like this:

  shared:
    path: ../shared

Then I can just do this:

import 'package:shared/shared.dart';