1

I want to develop a Dart project for both server and client programming; obviously, I need to share code between the two.

I got dart package layout basics. My question: is there one advised configuration? Do I have more than one option? Like one project with both client server parts in it. Or, more than one project with the various parts split between them...

I found other questions on SO, but:

  • they are 'work in progress' and really old
  • contains outdated links

The most interesting questions are:

Thanks

Community
  • 1
  • 1
Jako
  • 2,489
  • 3
  • 28
  • 38

1 Answers1

4

I'd suggest to split it into three packages.

  • client
  • server
  • shared

The main advantage is, that packages used in client or server don't need to be compatible with each other, only within client+shared or within server+shared they need to be compatible, but that's usually a notable smaller set. Less dependencies means less opportunity of having conflicting dependency constraints.

A disadvantage might come up when your IDE doesn't make it easy to work with projects that's spread over several packages. IntelliJ does this well. I don't know about others.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567