@@ -316,19 +316,19 @@ Future<String> _dotDelimiterStyleDefinition(
316
316
List <Integration > integrations,
317
317
) async {
318
318
final rootPath = Directory (config.rootPath).absolute.uri.toFilePath ();
319
- final buffer = StringBuffer ( );
320
- final className = config.flutterGen.assets.outputs.className ;
319
+ final packageName = generatePackageNameForConfig (config );
320
+ final outputs = config.flutterGen.assets.outputs;
321
321
final assetRelativePathList = _getAssetRelativePathList (
322
322
rootPath,
323
323
config.assets,
324
324
config.exclude,
325
325
);
326
- final assetsStaticStatements = < _Statement > [];
327
-
328
326
final assetTypeQueue = ListQueue <AssetType >.from (
329
327
_constructAssetTree (assetRelativePathList, rootPath).children,
330
328
);
331
329
330
+ final assetsStaticStatements = < _Statement > [];
331
+ final buffer = StringBuffer ();
332
332
while (assetTypeQueue.isNotEmpty) {
333
333
final assetType = assetTypeQueue.removeFirst ();
334
334
String assetPath = join (rootPath, assetType.path);
@@ -346,13 +346,7 @@ Future<String> _dotDelimiterStyleDefinition(
346
346
final List <_Statement ?> results = await Future .wait (
347
347
assetType.children
348
348
.mapToUniqueAssetType (camelCase, justBasename: true )
349
- .map (
350
- (e) => _createAssetTypeStatement (
351
- config,
352
- e,
353
- integrations,
354
- ),
355
- ),
349
+ .map ((e) => _createAssetTypeStatement (config, e, integrations)),
356
350
);
357
351
final statements = results.whereType <_Statement >().toList ();
358
352
@@ -368,14 +362,15 @@ Future<String> _dotDelimiterStyleDefinition(
368
362
assetsStaticStatements.add (statement! );
369
363
} else {
370
364
final className = '\$ ${assetType .path .camelCase ().capitalize ()}Gen' ;
365
+ String ? directoryPath;
366
+ if (outputs.directoryPathEnabled) {
367
+ directoryPath = assetType.posixStylePath;
368
+ if (packageName != null ) {
369
+ directoryPath = 'packages/$packageName /$directoryPath ' ;
370
+ }
371
+ }
371
372
buffer.writeln (
372
- _directoryClassGenDefinition (
373
- className,
374
- statements,
375
- config.flutterGen.assets.outputs.directoryPathEnabled
376
- ? assetType.posixStylePath
377
- : null ,
378
- ),
373
+ _directoryClassGenDefinition (className, statements, directoryPath),
379
374
);
380
375
// Add this directory reference to Assets class
381
376
// if we are not under the default asset folder
@@ -395,10 +390,9 @@ Future<String> _dotDelimiterStyleDefinition(
395
390
assetTypeQueue.addAll (assetType.children);
396
391
}
397
392
}
398
- final String ? packageName = generatePackageNameForConfig (config);
399
393
buffer.writeln (
400
394
_dotDelimiterStyleAssetsClassDefinition (
401
- className,
395
+ outputs. className,
402
396
assetsStaticStatements,
403
397
packageName,
404
398
),
0 commit comments