stablekernel/aqueduct

Cannot have any dependencies that use Flutter.

Closed this issue · 2 comments

I am trying to migrate my back end from TS on Firebase to Aqueduct. (or at least would like to try it)
I have a package that holds all my model classes. but it depends on flutter because of some extensions I built in there. (not a great idea, I know. it has a TODO to move it out) So, when I add the models package to my aqueduct project, and try to use it, I get these types of errors:

../../../../development/flutter/packages/flutter/lib/src/material/animated_icons.dart:9:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui show Paint, Path, Canvas;
       ^
../../../../development/flutter/packages/flutter/lib/src/material/animated_icons.dart:10:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
../../../../development/flutter/packages/flutter/lib/src/material/app.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' as ui;
       ^
../../../../development/flutter/packages/flutter/lib/src/material/app_bar_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
../../../../development/flutter/packages/flutter/lib/src/material/arc.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
../../../../development/flutter/packages/flutter/lib/src/material/bottom_app_bar_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
../../../../development/flutter/packages/flutter/lib/src/material/bottom_navigation_bar_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
../../../../development/flutter/packages/flutter/lib/src/material/bottom_sheet.dart:6:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
../../../../development/flutter/packages/flutter/lib/src/material/bottom_sheet_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^
../../../../development/flutter/packages/flutter/lib/src/material/button_bar_theme.dart:5:8: Error: Not found: 'dart:ui'
import 'dart:ui' show lerpDouble;
       ^

From what I understand, the only way to get around this, is to refactor my code to remove the flutter dependency from the model package as well as any other package that my aqueduct server will rely on.

Is that correct?

Yes that is the only way.

Advice: Sharing models between Frontend and Backend is not a good idea in general.

Thank you for the prompt reply.

Advice: Sharing models between Frontend and Backend is not a good idea in general.

Could you explain why that is?
(is there a better place we can discuss this, other than this ticket? I could hit you up on the slack channel)