For this question to make any sense at all I'm going to explain my current project structure first. For the company I'm working for I've made a platform to build apps quickly and customizable for every customer we have. So the project works with 2 repositories.
1) The app repository
This repository contains all the customizable files for the app. It is basically the entire flutter project without the lib and test directory.
2) The core repository
For the app to be functional the core repository is loaded in the app repository. (This contains all the .dart files). We did it this way because if we make a change to the core it is updated in all the apps we're creating by doing a simple git pull on the core.
Now comes the part that I can't figure out. We now have a customer that wants a custom functionality in the app. We cannot use this functionality again so I wanted to add that piece of code to the app repository. This is the file structure (Only showing what's needed)
Project
- assets
- customLib (the files for the custom work for the customer, part of the app repo)
- lib (all the files in this directory come from the core repo)
- test (all the files in this directory come from the core repo)
- pubspec.yaml
in one of my files in the core app I'm loading in the file.
This is the file /lib/Library/ModuleRouter.dart
Loading it like this: import '../../customLib/customLibs.dart';
It does not matter what I try but when I go outside the scope of where main.dart is placed the code simply isn't found. The files exist though.
This is the error I'm getting from the compiler:
Compiler message:
Error: Invalid package URI 'package:/customLib/customLibs.dart':
Invalid argument (packageUri): Package URIs must not start with a '/': Instance of '_SimpleUri'.
lib/Library/ModuleRouter.dart:25:8: Error: Not found: 'package:/customLib/customLibs.dart'
import '../../customLib/customLibs.dart';
Sorry for the long post but I felt like explaining the whole project for a better understanding of the current project.
I hope someone can help me with this issue.
Kind regards,
Kevin Walter