title: How do I import a file from the test directory to use in a lib file?
body: <p>In an attempt to figure out an issue, I realized that my file <code>sqflite_datasource.dart</code> calls for something that is only found in the file <code>sqflite_datasource_test.mocks.dart</code>. I am trying to import the file <code>sqflite_datasource_test.mocks.dart</code> as a package to the file <code>sqflite_datasource.dart</code> so that I don't get the error anymore.</p>
  <p>I've tried the following and they don't work:</p>
  <pre><code>import 'package:rethink_chat/test/data/sqflite_datasource_test.mocks.dart'; 
  import '../test/data/sqflite_datasource_test.mocks.dart';
  </code></pre>
  <p>They both have red squiggly lines and if I hover over them, it asks if I want to create the file. It's not finding that it already exists.</p>
  <p>These are the files I have:</p>
  <pre><code>│   ├── data
  │   │   └── datasources
  │   │       ├── datasource_contract.dart
  │   │       └── sqflite_datasource.dart
  │   ├── main.dart
  │   └── models
  │       ├── chat.dart
  │       └── local_message.dart
  ├── test
  │   ├── data
  │   │   ├── sqflite_datasource_test.dart
  │   │   └── sqflite_datasource_test.mocks.dart
  │   └── widget_test.dart
  
  </code></pre>
  <p>I'll add the whole reason I'm trying this is because I'm having <a href="https://stackoverflow.com/questions/72499493/missingstuberror-update-no-stub-was-found-which-matches-the-arguments-of-this">this issue</a>. I determined <code>update</code> is being found in the test file, I think because I imported the mocks file there (they're both within the test folder). But the test file calls a function in <code>sqflite_datasource.dart</code> that uses <code>update</code>, which I haven't imported the mocks file to. So I'm trying to import the mocks file there because it has the information on what <code>update</code> is. I'm a total beginner so please bear with me, it's probably a very simple solution.</p>
  <p>Edit: I'm so confused. Some of the functions in <code>sqflite_datasource.dart</code> that use things other than &quot;update&quot; but similar, like &quot;query&quot; and &quot;insert&quot; work just fine. So I have no idea why &quot;update&quot; isn't working.</p>