


When omitting quotes, the syntax a:b means a is the package and b is the path.When using quotes, the behavior matches the current import behavior.This makes sense using the following rules: Matches current behavior, imports lib/src/data/user.dart Matches current behavior, imports lib/src/firestore.dart import "data/user.dart" // 6. Matches current behavior, imports lib/main.dart like #3 import "firestore.dart" // 5. "package:my_package/data.dart" import "./data.dart" // 4. "package:built_value/serializer.dart" import :data // 3. "package:built_value/built_value.dart" import built_value:serializer // 2.
#Import shorthand into swifttext code#
Is this really worth the shorter syntax? I really worry that we're making code significantly less consistent and readable in the name of brevity.Ĭc Assuming we are in lib/src/logic.dart of a package called my_package import built_value // 1. foo and "./foo.dart" and "foo.dart" all might mean the same thing (I think? I'm a little lost in the weeds.). There's numerous ways to write the same thing: foo and foo:foo and package:foo/foo.dart and. There are now somewhere around 8 ways to write an import of serializer.dart, some of which are only valid in certain locations, and all of which use overlapping syntax to mean different things (" :something means the package part was elided, but foo:something means add the package: back in, change the : to a / and add a. This is an extraordinary amount of new cognitive load for a user. serializer ` means `import "./serializer.dart"` when it occurs inside the previous `src/int_serializer.dart` library. src/int_serializer ` means `import "./src/int_serializer.dart"`, aka.`import "src/int_serializer.dart"`, when it occurs inside the previous `serializer.dart` library. `import :src/int_serializer ` means `import "package:built_value/src/int_serializer.dart" ` when it occurs in the previous `serializer.dart` library, or anywhere else in the same Pub package. `import built_value:serializer ` means `import "package:built_value/serializer.dart" `. `import built_value ` means `import "package:built_value/built_value.dart" `
